the file should not be opened? i thought it was supposed to be opened before being renamed...
anyway here's a part of my code, just ignore the networking part..
Code:
if( (inputFile = fopen(file1, "wb")) == NULL)
{
response[0] = 0x40;
sendall(connectedSock, (char*)response,1); //file not found
}
else
{
if( (fopen(file2,"rb")) == NULL)
{
fclose(inputFile);
printf("%d",rename(file1,file2));
response[0] = 0;
sendall(connectedSock, (char*)response,1); //change succesfull
}
else
{
response[0] = 0xA0;
fclose(inputFile);
sendall(connectedSock, (char*)response,1); //could not perform change
}
}