_fdopen()

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.
 
D

Douglas J. Steele

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top