Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


rename files

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Mon Aug 27, 2007 5:45 pm    Post subject: rename files Reply with quote

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
View user's profile Send private message
smartz993
I post too much
Reputation: 2

Joined: 20 Jun 2006
Posts: 2013
Location: USA

PostPosted: Mon Aug 27, 2007 5:47 pm    Post subject: Reply with quote

JK!
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Mon Aug 27, 2007 5:49 pm    Post subject: Reply with quote

doesn't matter, same effect >.>
_________________
Back to top
View user's profile Send private message
smartz993
I post too much
Reputation: 2

Joined: 20 Jun 2006
Posts: 2013
Location: USA

PostPosted: Mon Aug 27, 2007 5:51 pm    Post subject: Reply with quote

It looks fine to me.. O.O
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Mon Aug 27, 2007 5:53 pm    Post subject: Reply with quote

when i run i get a return of -1

0 = file renamed

the file is at the right path...

_________________
Back to top
View user's profile Send private message
appalsap
Moderator
Reputation: 0

Joined: 27 Apr 2006
Posts: 6753
Location: Pakistan

PostPosted: Mon Aug 27, 2007 5:56 pm    Post subject: Reply with quote

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
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Mon Aug 27, 2007 5:57 pm    Post subject: Reply with quote

thanks you

works fine...does anyone here have a zune?

_________________
Back to top
View user's profile Send private message
smartz993
I post too much
Reputation: 2

Joined: 20 Jun 2006
Posts: 2013
Location: USA

PostPosted: Mon Aug 27, 2007 5:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites