Click to See Complete Forum and Search --> : Win CE cannot open my .doc file


irb4
September 24th, 2006, 10:58 PM
with evc++ 2002

[source]

//window init
FILE *fp;
static char TextBuffer[T_TEXT_BUFFER_SIZE] = {0};

fp=fopen("\\Temp\\agon.doc", "wt");

//case wm_user
fprintf (fp, "fclose example");

//fprintf(fp, TextBuffer);
//fprintf (fp, "%d",x); //all these didn't work

//when windows exit
fclose(fp);

[\source]

windows ce mobile 5 says: a problem with the document have been encountered and it cannot be opened.

Now what is wrong with my code?

ahoodin
September 25th, 2006, 07:40 AM
Well since your using what appears to be standard io libraries, I would check the value of errno. Use strerror(). Additionally you may be able to use GetLastError() with Windows.

For the most part problems like this are usually due to path problems or permissions.

HTH,

humptydumpty
September 25th, 2006, 08:01 AM
First thing Check your File Path(absolute path).Second thing .make a Check Whether File is opened or not

FILE *stream ;
if( (stream = fopen( "FilePath", "wt" )) == NULL )
printf( "The file 'FilePath' was not opened\n" );
else
printf( "The file 'FilePath' was opened\n" );


Thanx

irb4
September 25th, 2006, 08:55 PM
Thank you, muah muah!

humptydumpty
September 25th, 2006, 11:30 PM
you Welcome but not do that much :p