RE: WinCE 4.0 File I/O .

"Patrick Sweeney" <[email protected]>
Newsgroups gmane.comp.windows.ce.freeware
Message-ID <45842A3C4C95FC4EBEEBDA087F963BC104AA6B@magnatec-ml310.magnaweb.local>
I don't know if you got an answer to your question, or if this will even
answer it, but this is how I read text files:
 
 #define MAX_PATH          260
 
 FILE *stream;
 TCHAR *buffer = NULL;
 TCHAR INFFile[MAX_PATH];
 TCHAR line[MAX_PATH];

 // build path
 wcscpy(INFFile, _T(" <file://\\FlashFx> \\FlashFx Disk\\pathtofile.txt"));
 DEBUGMSG(TRUE, (_T("\r\nConfig File %s\r\n"), INFFile));
 
 // Open INF file
 if((stream = _wfopen(INFFile, _T("rt"))) == NULL)
 {
      RETAILMSG(TRUE, (_T("Can't find data file: %s\r\nGetLastError
returned: %d\r\n"), INFFile, GetLastError()));
      MessageBox(NULL, TEXT("Unable to load screen data"), TEXT("Failure"),
MB_OK);
      exit(-1);
      return 3;
 }
 DEBUGMSG(TRUE, (_T("Loading Data\r\n"), INFFile));

 // get a line of file data
 _fgetts(line, MAX_PATH, stream);
 
Line of data from file is in variable line
 
etc...
 
Writing is similiar:
 
 TCHAR INFFile[MAX_PATH];
 FILE *stream;
 int alllevels=0;
 int tempo=0;
 
 // build paths
 _tcscpy(INFFile, _T(" <file://\\FlashFx> \\FlashFx Disk\\pathtofile.txt"));
 
 DEBUGMSG(TRUE, (_T("\r\nWrite File %s\r\n"), INFFile));
 
 // Open INF file
 if((stream = _wfopen(INFFile, _T("wt"))) == NULL)
    {
        RETAILMSG(TRUE, (_T("Can't Open file %s for save: %s\r\nGetLastError
returned: %d\r\n"), INFFile, GetLastError()));
        return FALSE;
    }
 DEBUGMSG(TRUE, (_T("File Open %s\r\n"), INFFile));
 
 // Write Data
 fwprintf(stream,_T("%s\n"), _T("Some Text 1"));
 fwprintf(stream,_T("%s\n"), _T("Some Text 2"));
 
etc...
 
This is from my real code base, but I hacked out my proprietary stuff, so
watch out for syntax errors. Feel free to ask if you have any problems.
Hope this helps,
-Patrick Sweeney
[email protected]
 
 

 

-----Original Message-----
From: sandeep5_555 [mailto:sandeep5_555-/[email protected]] 
Sent: Monday, April 19, 2004 6:07 AM
To: [email protected]
Subject: [wince-devel] WinCE 4.0 File I/O .


Hi all,

I am a beginner in WinCE-embedded VC++. I need to run an application
(C code) in Wince-embdd VC++ 4.0 where file input/output is needed. 
Could anyone please help me out in this regard.

I have already run the applctn in WinCE 3.0 using the "Palm300" 
folder for I/O. But i did not find any such folder in WinCE 4.0.

I request you to please help me out.

Regards,
Sandeep.



  _____  

Yahoo! Groups Links


*	To visit your group on the web, go to:
http://groups.yahoo.com/group/wince-devel/
  

*	To unsubscribe from this group, send an email to:
[email protected]
<mailto:[email protected]?subject=Unsubscribe> 
  

*	Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> . 




[Non-text portions of this message have been removed]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.