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