Article View: comp.sys.atari.st
Article #26840Re: Megamax Binary Files
From: John Stanley
Date: Fri, 15 May 1987 20:13
Date: Fri, 15 May 1987 20:13
30 lines
1662 bytes
1662 bytes
In article <1971@ihuxy.ATT.COM> nowlin@ihuxy.ATT.COM (Jerry Nowlin) writes:
>
>I've noticed a problem with Megamax and reading binary files. The
>following code is used to copy one file to another. It works fine except
>that the file being copied, the one being read, gets one byte longer after
>every copy.
>
> if ((in = fopen(old,"br")) == NULL) {
> fprintf(stderr,"ERROR: can't open '%s' to read\n",old);
> return 0;
> }
>
> if ((out = fopen(new,"bw")) == NULL) {
> fprintf(stderr,"ERROR: can't open '%s' to write\n",new);
> fclose(in);
> return 0;
> }
...[rest of sample code]....
Jerry, if you're trying to do "binary" file copys, you'd have better
luck (both reliability and (!)speed) if you used the raw mode disk io
functions and bipass the fopen/fread/fetc.. overhead entirely...
The functions Fopen, Fread, etc are not 100% portable between systems,
but you're much less likely to get wierd effects if you use them...
---
John Stanley (john@viper.UUCP)
Software Consultant - DynaSoft Systems
UUCP: ...{amdahl,ihnp4,rutgers}!{meccts,dayton}!viper!john
Technical Details
Message-ID:
<988@viper.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rutgers!dayton!viper!johnReferences:
<1971@ihuxy.ATT.COM>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!rutgers!dayton!viper!john From: john@viper.UUCP (John Stanley) Newsgroups: comp.sys.atari.st Subject: Re: Megamax Binary Files Message-ID: <988@viper.UUCP> Date: Fri, 15-May-87 16:13:01 EDT Article-I.D.: viper.988 Posted: Fri May 15 16:13:01 1987 Date-Received: Sun, 17-May-87 01:39:48 EDT References: <1971@ihuxy.ATT.COM> Reply-To: john@viper.UUCP (John Stanley) Organization: DynaSoft Systems Lines: 30 Keywords: read writes, binary files