944,210 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 2847
  • C RSS
Nov 2nd, 2006
0

Storing file input to an array?

Expand Post »
Hello, well, as the title states, I need to take the file input and store it into a string. It seems simple enough, just setup a for loop going through the total number of characters in the file input, or just do a while !EOF loop, the part I'm not sure about is the code that actually stores the values into the string. Using scanf or fscanf leaves out blank spaces and new lines, so the printed output doesn't match the file input properly.

How do I go about this? declaring a file pointer and then setting that to fopen and the filename works fine, and printing directly from the input works as well, but I need to store the input into a string and manipulate it from there. Any and all help is as always appreciated. Thanks everyone.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Savage221 is offline Offline
20 posts
since Oct 2005
Nov 2nd, 2006
0

Re: Storing file input to an array?

Did you tried with fgets? For help read this
Reputation Points: 251
Solved Threads: 29
Posting Whiz in Training
andor is offline Offline
274 posts
since Jun 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: hi i need help
Next Thread in C Forum Timeline: Visual inheritance





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC