home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / programm / 3549 < prev    next >
Encoding:
Internet Message Format  |  1993-01-21  |  1.9 KB

  1. Path: sparky!uunet!usc!rpi!uwm.edu!linac!mp.cs.niu.edu!news.ecn.bgu.edu!uxa.ecn.bgu.edu!not-for-mail
  2. From: mgmam@uxa.ecn.bgu.edu (Mark A. Morrell)
  3. Newsgroups: comp.programming
  4. Subject: Re: Maximum file size for MS-DOS
  5. Date: 21 Jan 1993 22:39:48 -0600
  6. Organization: Educational Computing Network
  7. Lines: 28
  8. Distribution: usa
  9. Message-ID: <1jntqkINN3m1@uxa.ecn.bgu.edu>
  10. References: <31744@nntp_server.ems.cdc.com>
  11. NNTP-Posting-Host: uxa.ecn.bgu.edu
  12.  
  13. In article <31744@nntp_server.ems.cdc.com> mtoms@ems.cdc.com writes:
  14. >I need some help concerning reading/writing a binary data file to disk using
  15. >Microsoft C Version 6.01 on a MS-DOS based machine.
  16. >
  17. >I created a file using fopen and began writing records to it.  I used
  18. >fclose when I was done.  This part seems to work fine.
  19. >
  20. >However, when I began reading records (fseek, followed by fread) from 
  21. >the file, fread failed when I got to about 65535 into the file.  I
  22. >noticed that size_t is an unsigned int (16 bits??).
  23. >Does anyone have any ideas how to write a data file (about 3 Meg) to
  24. >disk?  Am I using the wrong functions?
  25.  
  26. You are probably using the right functions, but the wrong variables.  I
  27. am not familiary with Microsoft C, but I do know that the DOS seek
  28. function uses 32 bits.  If you are passing a 16 bit variable to the
  29. function (and, of course, C won't tell you it's the wrong type), then
  30. you won't be able to read past 65535.  It also seems likely that however
  31. you are finding the address, you are just losing your high bits (and, of
  32. course, C won't tell you about that either...).
  33.  
  34. You can read and write files with the standard DOS functions to over 4
  35. Gigabytes.  I myself have created files 1+ Gigabytes in size with
  36. standard DOS functions.
  37. -- 
  38. --------------------------------------------------------------------
  39. Mark A. Morrell     Disclaimer:  _I_ probably don't even believe it.
  40. Literary Reference:  The introduction to Cervantes' Don Quixote.
  41.