Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / Strange wxFFile functionality

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Strange wxFFile functionality
#4288
Posted by: 2004-05-30 13:53:17
Hi,

I'm using wxWidgets 2.4.2 with Dev-C++ on a Windows XP machine. The code snippet below creates a simple text file that contains 10 lines. Here's the strange thing. I checked the resulting text file with a hex editor and noticed that each line/record is terminated with <cr><cr><lf>. Where is the extra <cr> coming from? The wxFile class worked as expected, each record is delimited by <cr><lf>. I'm totally stumped, any help would be appreciated. thanks


    wxFFile outFile;
    wxFFileOutputStream fileOutStrm(outFile);
    wxTextOutputStream textOutStrm(fileOutStrm);
    wxString rec;

    if (outFile.Open("c:\\temp\\test.txt", "w")) {
      for (int linePos = 0; linePos < 10; linePos++) {
        rec.Printf("Line# %d", linePos);
        #if 0
          textOutStrm << rec << endl;
        #else
          textOutStrm.WriteString(rec + '\n');
        #endif
      } 
    }
    else {
      wxMessageBox("could not open test.txt");
    }   
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
¥738.00 ·
 
 
¥1,480.00 ·
 
 
¥397.00 ·
 
 
¥950.00 ·
 
 
¥264.00 ·
 
 
¥1,005.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0