![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Re: Structures and Reading from File
@ccfc: I'm sorry, but writing a textual "end of file" is a trash approach to the condition. You're not alone, however. Even MS, in their "text" mode, use content (ctrl-Z) to form an "end of file" character.
The problem with this approach, aside from being unnecessary, is that one now has an entity that has to be dealt with in the case of appends. See the MS docs for the caveats. EOF is a condition. The various library functions deal with it and make its presence known in various ways. Use those and other people will know how to deal with your code. It's a professional thing. @null_ptr: Please do not just repeat previous responses. The OP is writing in C++; there's no good reason, in this case, to strain at a gnat and use C comparison functions. We get it that you're an 11-year old genius, okay? ![]()
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#12 |
|
12 years old
Join Date: Nov 2007
Posts: 80
Rep Power: 1
![]() |
Re: Structures and Reading from File
haha, I didn't realize I repeated a previous response.
|
|
|
|
|
|
#13 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Re: Structures and Reading from File
Try reading the thread....
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#14 | |
|
hi: for(;;) goto hi;
|
Re: Structures and Reading from File
Quote:
![]() edit: Pardon my speed, read the whole thing and replied without refreshing!
__________________
How do you play Religious Roulette? Stand around in a circle and blaspheme till someone gets struck by lightning. |
|
|
|
|
|
|
#15 |
|
Newbie
Join Date: Nov 2007
Posts: 4
Rep Power: 0
![]() |
Re: Structures and Reading from File
Dawei - Thanks for your help. I realize what i did wrong - and i corrected my mistake. I completely forgot that i can test for such a thing without doing what i did. So once again - thanks again for the help.
Cheers all. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Changing Array structures to Linked Lists? | kalulu | C | 4 | Nov 29th, 2005 6:33 AM |
| C files and structures | Princeck | C++ | 2 | Feb 24th, 2005 2:09 PM |