home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ogicse!psgrain!hippo!ucthpx!uctvax.uct.ac.za!trrgre03
- From: trrgre03@uctvax.uct.ac.za
- Newsgroups: comp.lang.c++
- Subject: fstream problem
- Message-ID: <1992Dec27.141319.203428@uctvax.uct.ac.za>
- Date: 27 Dec 92 16:13:19 GMT
- Article-I.D.: uctvax.1992Dec27.141319.203428
- Organization: University of Cape Town
- Lines: 32
-
- Can some one please help me?
-
- I have been trying for a few days to get a program to work. It reads a dBase
- 'dbf' file, to get out the underlying structure. For some reason, though, it
- refuses to read the character that terminates the field descriptions (an
- ASCII 13 (hex 0D)). It just seems to skip over it like it isn't there. What
- am I doing wrong? Any suggestions?
-
- I'm using Turbo C++ 3.0, and the ifstream class.
-
- This is a simplified version of the program:
-
- ifstream testfile ("c:\\dbftest.dbf", ios::binary||ios::nocreate);
- char c = 0;
-
- while ( (!testfile.eof()) && (c != 13) )
- {
- testfile.get (c);
- cout << c;
- }
-
- I've tried various ifstream member functions, including:
-
- int get()
- istream& get (signed char&)
- int peek()
- istream& read (signed char*, int);
-
- None of these seem to work, though. When stepping through the loop with the
- debugger, they never return an ASCII 13.
-
- Can anyone help. Please Email any responses.
-