Walt Mankowski on Wed, 19 Jun 2002 22:32:01 -0400


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] this code crashes [OT]


On Wed, Jun 19, 2002 at 09:22:43PM -0400, Fred K Ollinger wrote:
> Here's the whole (broken) function:

This function worked for me, or at least it did after I converted it
back to plain C.  Since you're not checking the return codes from your
fopen() calls I'm guessing that's what your problem is.

Try changing your calls to look like this:

if ((source = fopen(src, "r")) == NULL) {
   perror(src);
   return 1;
}

if ((dest = fopen(dst, "r")) == NULL) {
   perror(dst);
   return 1;
}

Attachment: pgpB85iXCwDSl.pgp
Description: PGP signature