Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
strcmpi failing?

 
Post new topic   Reply to topic Printable version
 View previous topic  c++ GUI Post :: Post Quadtree C# fun!  View next topic  
Author Message
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1017
Offline

PostPosted: Wed Sep 10, 2008 11:55 pm    Post subject: strcmpi failing? Reply to topic Reply with quote

on mervbot ive got a comparison:

char offenders[20]={'C','h','e','e','s','e','\0'};
if(strcmpi(offenders,m_name)||1)
{
//stuff
}

i had to add the or 1 temporarily, because i couldnt get it to succeed any way i tried.

i also tried
char offenders[20]="Cheese"
char offenders[20]="cheese"

and a whole bunch of other crap.

this uses one of the outputs of my unpacker, which is:
char m_name[20]


i cant get this to work, any ideas?


-edit-
also, tiny extra:
whats the way to have a single character, buf=='/'
i know it wont accept it, it has to be '//' or '\/' or '\\/' or some other crap...
because of the line break / in the compiler.

-edit2-
and before i forget, sscanf seems to be failing too... =/
isnt %d for a signed int?
every time i send it a negative number, it fails...

signed int temp6 = 0;
sscanf(c->final, "%d", &temp6);
_________________
SSC Distension Owner
SSCU Trench Wars Developer
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
k0zy
Server Help Squatter


Gender:Gender:Male
Joined: Jan 11 2003
Posts: 571
Location: Germany
Offline

PostPosted: Thu Sep 11, 2008 1:11 am    Post subject: Reply to topic Reply with quote

stcmpi returns 0 if the two strings are identical.

0 equals false, so if you want something to happen if the two strings are equal you have to do:

if (!strcmpi(x,y))

or

if (strcmpi(x,y) == 0)
_________________
It's a shark! Oh my god! Unbelievable!
Back to top
View users profile Send private message Add User to Ignore List
Dr Brain
Flip-flopping like a wind surfer


Age:38
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Thu Sep 11, 2008 6:35 am    Post subject: Reply to topic Reply with quote

==0 is the preferred syntax.
_________________
Hyperspace Owner

Smong> so long as 99% deaths feel lame it will always be hyperspace to me
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1017
Offline

PostPosted: Thu Sep 11, 2008 4:16 pm    Post subject: Reply to topic Reply with quote

aargh, nonzero is supposed to be true =(


thanks =P
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Thu Sep 11, 2008 5:01 pm    Post subject: Reply to topic Reply with quote

nonzero is true, but strcmp (and related functions) don't return true or false tongue.gif
They return the difference between the two strings; so 0 means no difference. You can use it to sort strings; if it returns positive, it means one of the string is 'higher', alphabetically-speaking than the other, and a negative return value would mean the opposite.
_________________
(Insert a bunch of dead links here)
Back to top
View users profile Send private message Add User to Ignore List
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Non-Subspace Related Coding All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can 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 can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 667 page(s) served in previous 5 minutes.

phpBB Created this page in 0.476802 seconds : 30 queries executed (81.0%): GZIP compression disabled