The file is still open. Close it first before trying to rename it. Move line 22 up to about line 16
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
what version of MS-Windows are you running? Use Windows Explorer to see if it will rename the file to that ip address.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
fgets() add the '\n' to the end of the string if it exists in the file. So you need to strip it off before calling rename().
fgets (ipadd , 16 , pFile);
if( ipadd[strlen(ipadd)-1] == '\n')
ipadd[strlen(ipadd)-1] = 0;
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
fseek is causing the problem..
Yes, that is the major problem.
Here is the entire line that he is trying to read Before Renamesk . . . . . . . . . . . : 255.255.255.0
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343