| View previous topic :: View next topic |
| Author |
Message |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Mon Aug 27, 2007 5:45 pm Post subject: rename files |
|
|
| Code: | #include <stdio.h>
#include <iostream.h>
using namespace std;
int main()
{
int result;
char oldname[] ="C:\Program Files\Zune\ZuneMarketplace.dll";
char newname[] ="C:\Program Files\Zune\ZuneMarketplace1.dll";
result = rename(oldname,newname);
if ( result == 0 )
cout << "File successfully renamed";
else
cout << "Problem";
cin.get();
return 0;
}
|
it returns problem, what could be wrong?
_________________
|
|
| Back to top |
|
 |
smartz993 I post too much
Reputation: 2
Joined: 20 Jun 2006 Posts: 2013 Location: USA
|
Posted: Mon Aug 27, 2007 5:47 pm Post subject: |
|
|
| JK!
|
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Mon Aug 27, 2007 5:49 pm Post subject: |
|
|
doesn't matter, same effect >.>
_________________
|
|
| Back to top |
|
 |
smartz993 I post too much
Reputation: 2
Joined: 20 Jun 2006 Posts: 2013 Location: USA
|
Posted: Mon Aug 27, 2007 5:51 pm Post subject: |
|
|
| It looks fine to me.. O.O
|
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Mon Aug 27, 2007 5:53 pm Post subject: |
|
|
when i run i get a return of -1
0 = file renamed
the file is at the right path...
_________________
|
|
| Back to top |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Mon Aug 27, 2007 5:56 pm Post subject: |
|
|
change it to
| Code: |
char oldname[] ="C:\\Program Files\\Zune\\ZuneMarketplace.dll";
char newname[] ="C:\\Program Files\\Zune\\ZuneMarketplace1.dll";
|
otherwise it thinks the slashes are escape characters
|
|
| Back to top |
|
 |
HomerSexual Grandmaster Cheater Supreme
Reputation: 5
Joined: 03 Feb 2007 Posts: 1657
|
Posted: Mon Aug 27, 2007 5:57 pm Post subject: |
|
|
thanks you
works fine...does anyone here have a zune?
_________________
|
|
| Back to top |
|
 |
smartz993 I post too much
Reputation: 2
Joined: 20 Jun 2006 Posts: 2013 Location: USA
|
Posted: Mon Aug 27, 2007 5:58 pm Post subject: |
|
|
Try this:
| Code: | #include <stdio.h>
#include <iostream.h>
#include <fstream.h>
using namespace std;
int main()
{
int result;
char oldname[] ="C:\\Program Files\\Zune\\ZuneMarketplace.dll";
char newname[] ="C:\\Program Files\\Zune\\ZuneMarketplace1.dll";
result = rename(oldname,newname);
if (result != 0 ) {
cout << "Problem" << endl;
return -1;
}
// Got to here, so successful rename
cout << "File successfully renamed" << endl;
cin.get()
return;
} |
Nevermind, appalsap strikes again!! Lol.
|
|
| Back to top |
|
 |
|