home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / cplus / 18445 < prev    next >
Encoding:
Internet Message Format  |  1992-12-27  |  1.3 KB

  1. Path: sparky!uunet!ogicse!psgrain!hippo!ucthpx!uctvax.uct.ac.za!trrgre03
  2. From: trrgre03@uctvax.uct.ac.za
  3. Newsgroups: comp.lang.c++
  4. Subject: fstream problem
  5. Message-ID: <1992Dec27.141319.203428@uctvax.uct.ac.za>
  6. Date: 27 Dec 92 16:13:19 GMT
  7. Article-I.D.: uctvax.1992Dec27.141319.203428
  8. Organization: University of Cape Town
  9. Lines: 32
  10.  
  11. Can some one please help me?
  12.  
  13. I have been trying for a few days to get a program to work. It reads a dBase
  14. 'dbf' file, to get out the underlying structure. For some reason, though, it
  15. refuses to read the character that terminates the field descriptions (an
  16. ASCII 13 (hex 0D)). It just seems to skip over it like it isn't there. What
  17. am I doing wrong? Any suggestions?
  18.  
  19. I'm using Turbo C++ 3.0, and the ifstream class.
  20.  
  21. This is a simplified version of the program:
  22.  
  23. ifstream testfile ("c:\\dbftest.dbf", ios::binary||ios::nocreate);
  24. char c = 0;
  25.  
  26. while (  (!testfile.eof())  &&  (c != 13)  )
  27. {
  28.    testfile.get (c);
  29.    cout << c;
  30. }
  31.  
  32. I've tried various ifstream member functions, including:
  33.  
  34.      int get()
  35.      istream& get (signed char&)
  36.      int peek()
  37.      istream& read (signed char*, int);
  38.  
  39. None of these seem to work, though. When stepping through the loop with the
  40. debugger, they never return an ASCII 13.
  41.  
  42. Can anyone help. Please Email any responses.
  43.