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.
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..
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.
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.
Don''t foget fflush() !
As I know but if you use the fflush() to clear stdin buffer, it would be cleared and it doesn't show the output
actually, fflush(stdin) is undefined behavior
Actually, I was referring to between fprintf() and fclose() in agdgdgdgwngo's reply.
Join our real-time social learning platform and learn together with your friends!