Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

nphuongsun93

C programming How do I get numbers (or data) from a file (.txt) and write things into a file? I need to get data using loops but i'm not sure how to do.

  • one year ago
  • one year ago

  • This Question is Closed
  1. eSpeX
    Best Response
    You've already chosen the best response.
    Medals 1

    Assuming that if you are doing file I/O you understand loops, you need to create a file pointer and assign it a value. Then you write to/read from that stream.

    • one year ago
  2. eSpeX
    Best Response
    You've already chosen the best response.
    Medals 1

    You can use EOF or the \n char as an indicator you've reached the end of the file or end of the line. Check here for some examples: http://www.cprogramming.com/tutorial/cfileio.html

    • one year ago
  3. nphuongsun93
    Best Response
    You've already chosen the best response.
    Medals 0

    thanks i will try this. I have an execute file (sample) that i need to write code for it. Do you have time to give it a look and give me some hints, if that's ok?

    • one year ago
  4. eSpeX
    Best Response
    You've already chosen the best response.
    Medals 1

    If it is something you would like reviewed then it is always a good idea to include it in your question. I am heading out the door right now but could look at it in a few hours and offer input if you'd like.

    • one year ago
  5. nphuongsun93
    Best Response
    You've already chosen the best response.
    Medals 0

    all right, anytime will do. to test the exe file, you will need to create a new txt file in the same folder (name it 123.txt for example), then run the .exe, then type "numbers.dat", then "123.txt". The .exe will calculate with the input from "numbers.dat" and put it into "123.txt". writting the code for the .exe is what i need to do. Thanks in advance

    • one year ago
    • Attachments:

See more questions >>>

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.