_fdopen()

  • Thread starter Thread starter Gil
  • Start date Start date
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.
 
This newsgroup is for questions about coding in VBA (specifically in Access,
the database product that's part of Office Professional).

Your code snippet would appear to be C or some variation thereof. You'd be
better off reposting your question to a more appropriate newsgroup.
 
Back
Top