• Subject: Re: Wite to a save file with _RWrite
  • From: Dave McKenzie <davemck@xxxxxxxxxx>
  • Date: Thu, 16 Nov 2000 18:00:10 -0800

OOPS!  Of course I should have checked for EOF from the read before writing, 
such
as...

  if (pfFp->riofb.num_bytes != EOF) {
    _Rwrite(savFp, aRec, 528);
  }

...but since it isn't checking for errors, the pgm ignores the escape msg on 
the last
write and works fine anyway!

--Dave

Dave McKenzie wrote:

> Here's a little pgm that does that.  SAVF528 is a rcdlen(528) physical 
>containing
> data copied from a savf file with FTP, and ASAVF is a save file.
>
> --Dave
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
> #include <recio.h>
>
> static _RFILE  *pfFp;
> static _RFILE  *savFp;
>
> int  main(int argc, char **argv)
> {
>   char  aRec[528];
>
>   pfFp = _Ropen("SAVF528", "rr");
>   savFp = _Ropen("ASAVF", "wr");
>
>   do {
>     _Rreadn(pfFp, aRec, 528, __DFT);
>     _Rwrite(savFp, aRec, 528);
>   } while (pfFp->riofb.num_bytes != EOF);
>
>   _Rclose(pfFp);
>   _Rclose(savFp);
>   return;
> }

+---
| This is the C/400 Mailing List!
| To submit a new message, send your mail to C400-L@midrange.com.
| To subscribe to this list send email to C400-L-SUB@midrange.com.
| To unsubscribe from this list send email to C400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: bob@cstoneindy.com
+---

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].