Gudday all
I am trying to move TIFF files on the same server from one location to another. I have tried many things but my latest attempt is to open the file, read it in and write that same file to the new location.
I thought it would be easy but I keep getting unable to open file errors.
The copy function is
Code:
void copy(char *srcFilename, char *dstFileName)
{
FILE *fsrc, *fdst;
char c;
printf("Inside copy function\n");
fsrc=fopen(srcFilename, "rb");
if (fsrc==NULL) {
printf("Couldn't open file %s for reading.\n", srcFilename);
exit(0);
}
/* Add usual error check */
fdst=fopen (dstFileName, "w");
/*Add usual error check */
for ( ; !feof(fsrc); )
fputc (fgetc (fsrc), fdst);
fclose (fsrc);
fclose (fdst);
}
and I call it using
Code:
copy(tiff_file, tiffLine);
where tiffline is the destination and has the form "c:\TestingTiffMoves\AU\PICKLIST\0000544B.TIF" .
The path is fixed but the file name will be variable in name but not in length.
tiff_file is the local file, in this case "0000544B.TIF"
The error message is "Couldn't open file 0000544B.TIF for reading."
Is there a trick to this that I am missing?
Also how to we express paths in C? I am giivng the absolute path at present. Is it possible to use relative paths? If so what is the format?