0

I have function. FA->file_temp is a copy of FA->file. FA->file_temp is being in TEMP dir. (C:\Users\User\AppData\Local\Temp)

stat(FA->file, &st_file);
filesize = st_file.st_size;
ffile = fopen(FA->file_temp, "rb");
if (ffile == NULL) perror("NULL!!!!!!!!!!!!!1\n");

strcpy(str, FA->file_dir);
strcat(str, "packed");
temp_name(str) ;
strcpy( FA->tmpname , str);
ftmpname = fopen(FA->tmpname, "wb");
if (ftmpname == NULL) perror("NULL!!!!!!!!!!!!!1\n");
 if (rc = encode(ffile, ftmpname, filesize)!=0) 
     longjmp(Berror, rc);
baira
  • 59
  • 2
  • 11

1 Answers1

1

Perchance, does your program yell 'NULL!!!!!!!!!!!!' before assertion failed? The message about the assertion is saying that fo is null.

While I'm here,

if (rc = encode(ffile, ftmpname, filesize)!=0) 

Is probably not what you want. This stores all of encode(ffile, ftmpname, filesize)!=0 into rc. You probably meant:

if ((rc = encode(ffile, ftmpname, filesize))!=0) 
Dave
  • 10,964
  • 3
  • 32
  • 54
  • @sleepy, putting an assignment inside an `if` condition is one of the worst of ideas anyhow. The common idiom is to put the assignment before the `if` and then simply do `if (rc) `. – Jens Gustedt Apr 08 '12 at 08:34