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 


Open With help
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Jani
Grandmaster Cheater
Reputation: 2

Joined: 29 Dec 2006
Posts: 804

PostPosted: Mon May 05, 2008 3:52 am    Post subject: Reply with quote

Code:
int iCurrPos = filename.length();

do {
   iCurrPos = filename.rfind( "\\", iCurrPos );
   filename.insert(iCurrPos, "\\");
   --iCurrPos;
} while( iCurrPos > 0 );
Or something..? This one is kinda optimized as far as I know:
Code:
tuomi:(~)(64)% g++ test1.cpp
tuomi:(~)(65)% time ./a.out
\abc\dd\ee\ff\
\\abc\\dd\\ee\\ff\\
0.001u 0.000s 0:00.00 0.0%      0+0k 0+0io 0pf+0w
test1.cpp is the code mentioned above with two cout's.

Btw.. Why to do this:
Code:
char* cstr = new char [filename.size()+1];
strcpy (cstr, filename.c_str());
LoadFile(hEdit, cstr);
Doesn't
Code:
LoadFile(hEdit, filename.c_str() );
work? Or does your function LoadFile require a copy of the string? IMO it should be done in the function, not here.. (if you want to make it "re-usable".)

EDIT:
Jani wrote:
Or.. Switch to C++ and use std::string.replace :P
My bad.. Thought std::string.replace would work just like wxString.replace does, but it didn't: http://docs.wxwidgets.org/stable/wx_wxstring.html#wxstringreplace
Code:
wxString.replace("\\", "\\\\", true);
:)

Oh yeh... Blankrider said in IRC that those backslash thingys weren't the problem, but there were quotation marks around the params, and they caused the problem.
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
Goto page Previous  1, 2
Page 2 of 2

 
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