Hi all. I have an assignment for class (obviously I am new to this), that requires us to read from a file and then print out the first 22 characters from each line within that file. I have tried using getline and get, but can't seem to get it to work right. Is there a way to limit the amount of symbols that 'get' reads and then move to the next line and do the same thing? Thanks so much for your help!!
Jalwes
0
Newbie Poster
Recommended Answers
Jump to PostI think a better approach would be just use getline to grab all of a line into a large string, then print out the first 22 characters that appear (or less if the line's not that long.)
You can (with char array type strings) limit how much input getline …
All 4 Replies
vmanes
1,165
Posting Virtuoso
Jalwes
0
Newbie Poster
vmanes
1,165
Posting Virtuoso
csurfer
422
Posting Pro
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.