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 


[C++]Number of occurrences in a string?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Robotex
Master Cheater
Reputation: 0

Joined: 05 Sep 2006
Posts: 378
Location: The pizza country!

PostPosted: Sun Aug 12, 2007 6:36 am    Post subject: [C++]Number of occurrences in a string? Reply with quote

Well i'm coding a parser function, but the number of tokens isn't fixed, so i have to allocate memory before doing it.
Does anyone know a good way of finding number of occurrences without useless functions? (strstr/strchr)
Or i have to go with something like that?
int nTokens = 0;
int bufferlen = strlen(buffer);
for(int i = 0; i < bufferlen; i++)
if(buffer[i] == delimitator)
++nTokens;

_________________

ASM/C++ Coder
Project Speranza lead developer
Back to top
View user's profile Send private message
TheSorc3r3r
I post too much
Reputation: 0

Joined: 06 Sep 2006
Posts: 2404

PostPosted: Sun Aug 12, 2007 10:27 am    Post subject: Reply with quote

Why are strstr/strchr useless?
_________________


Don't laugh, I'm still learning photoshop!
Back to top
View user's profile Send private message
Robotex
Master Cheater
Reputation: 0

Joined: 05 Sep 2006
Posts: 378
Location: The pizza country!

PostPosted: Sun Aug 12, 2007 9:48 pm    Post subject: Reply with quote

because you have to do extra code to set the pointer
_________________

ASM/C++ Coder
Project Speranza lead developer
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