G
Gil
Hi everyone,
I have a function which writes some data into file. This is its interface:
void WriteDataToFile(FILE*);
I want to use it to buffer my data into memory instead of writing it into
disk-file. For that, I am using _fdopen as follows:
FILE *sptr=_fdopen( 0, "w" );
char buf[48000];
memset(buf, '\0', sizeof(buf));
setvbuf( sptr, buf, _IOFBF, sizeof( buf ) );
WriteToFile(sptr);
It seems working.
However, I suspect his code to cause my application to sometimes hang and
even crash. Could this code be the problem? What is the exact return value of
this call..:
_fdopen( 0, "w" );
Can I trust the FILE returned value and write to it?
Thanks,
Gil.
I have a function which writes some data into file. This is its interface:
void WriteDataToFile(FILE*);
I want to use it to buffer my data into memory instead of writing it into
disk-file. For that, I am using _fdopen as follows:
FILE *sptr=_fdopen( 0, "w" );
char buf[48000];
memset(buf, '\0', sizeof(buf));
setvbuf( sptr, buf, _IOFBF, sizeof( buf ) );
WriteToFile(sptr);
It seems working.
However, I suspect his code to cause my application to sometimes hang and
even crash. Could this code be the problem? What is the exact return value of
this call..:
_fdopen( 0, "w" );
Can I trust the FILE returned value and write to it?
Thanks,
Gil.