The line fullpath = temp; doesn't actually reset the var. I am not sure what I have to do. I have tried fullpath = *temp;. Could someone tell me why this is not working?

#include "stdio.h"
#include "stdlib.h" //Used for getenv();
#include "string.h" //Used for strcat();

int main(int argc, char* argv[])
    //Make vars
    FILE *self;
    FILE *ext;
    int lengthof;
    int sum;
    int fatpos;
    int i;
    int fcount;
    char filename[32];
    char *filedata;
    char *temp;
    char *fullpath;
    const int F_SIZE = 6144; //Size of this program (the stub)

    //Open self, set pointer to the end of the stub
    self = fopen(argv[0], "rb");
   	fseek(self, F_SIZE, SEEK_SET);

	//Read integer for number of files in archive
    fread(&fcount, sizeof(int), 1, self);
    //Figure out how long the FAT is
    sum = ((32 + sizeof(int)) * fcount) + sizeof(int);
    //Set up the position saver thing (used to keep the position in the FAT so program can seek back after file is read)
    fatpos = F_SIZE + sizeof(int);
    //Get the location of the temporary directory
    temp = getenv("TEMP");
    if(strlen(temp) > 3)
         strcat(temp, "\\");

	//Loop through the file names
	for(i = 0; i < fcount; i++)
          fread(filename, 32, 1, self);                //Read the file name of 32 bytes max (will auto terminate at zero byte)
          fatpos += 32;                                //Add 32 to the position
          fread(&lengthof, sizeof(int), 1, self);      //Get length of file
          fatpos += sizeof(int);                       //Add a long to the position
          fseek(self, F_SIZE + sum, SEEK_SET);         //Go to the file
          sum += lengthof;                             //Add to the length for the next file to read
          filedata=(char *)malloc(lengthof);           //Allocate memory for file data array
          fread(filedata, lengthof, 1, self);          //Read the file into array
          fullpath = temp;                      //Set fullpath to temporary directory
          strcat(fullpath, filename);                  //Add the filename to the temporary directory
          ext = fopen(filename, "wb");                 //Open the file
          fwrite(filedata, 1, lengthof, ext);          //Write to it
          fclose(ext);                                 //Close it
          fseek(self, fatpos, SEEK_SET);               //Return the pointer to location in the FAT to continue reading
    return 0;

what do you really have to do?

Through each for loop (on line 52), the variable fullpath has to be reset to the temporary directory. On another forum, someone said that it was not working because it was a pointer. So my question is why won't fullpath = temp?

what do you really have to do?

I am making a files extractor program.