Ace school

with brainly

  • Get help from millions of students
  • Learn from experts with step-by-step explanations
  • Level-up by helping others

A community for students.

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.

Computer Science
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions

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

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

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

Not the answer you are looking for?

Search for more explanations.

Ask your own question