Ask your own question, for FREE!
Computer Science 12 Online
OpenStudy (anonymous):

I want to write my output of a c code into a file using mapviewoffile in C. Can anyone help please. I have already checked the google links available. I am stuck. So, it would be really helpful if u can give a small example.

OpenStudy (anonymous):

map view of file, what does it mean ? such as Directory Viewer ?? if the one that you meant is Directory Viewer, you can try WINAPI in Win32 Env..

OpenStudy (anonymous):

No! mapviewoffile is a function in c through which you can map a part of the file or memory and write to or read from it.

OpenStudy (anonymous):

If you are writing to stdout, you can use the shell to redirect output to an arbitrary file like `./mapviewoffile > output.txt'. Otherwise, you might be able to use the FILE objects and the fopen, fclose, fprintf, etc.

OpenStudy (rsmith6559):

Don''t foget fflush() !

OpenStudy (anonymous):

As I know but if you use the fflush() to clear stdin buffer, it would be cleared and it doesn't show the output

OpenStudy (anonymous):

actually, fflush(stdin) is undefined behavior

OpenStudy (rsmith6559):

Actually, I was referring to between fprintf() and fclose() in agdgdgdgwngo's reply.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!