Quantcast

A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

harvardgal2103

  • 3 years ago

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.

  • This Question is Open
  1. yoshuajoe
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

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

  2. harvardgal2103
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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.

  3. agdgdgdgwngo
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    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.

  4. rsmith6559
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    Don''t foget fflush() !

  5. yoshuajoe
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

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

  6. agdgdgdgwngo
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    actually, fflush(stdin) is undefined behavior

  7. rsmith6559
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

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

  8. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.