baira
baira

Reputation: 59

perror: No such file or directory

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);

Upvotes: 0

Views: 1469

Answers (1)

Dave
Dave

Reputation: 11162

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) 

Upvotes: 1

Related Questions