Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

syntax problem with if strcmp

Status
Not open for further replies.

frumpus

Programmer
Aug 1, 2005
113
0
0
US
Thanks for reading my silly question. I'm new to aspect and struggling with some things that are probably very simple but not covered in my documentation.

I have two main questions:

first, i'm trying to do more than one strcmp in an if statement using || (as 'or') but can't get a useable syntax. one of many failed examples is:

if (strcmp room "206") || (strcmp room "306")
numboxes = 2
else
numboxes = 4
endif

I have more than 2 rooms to test so i can't just put the other one in an elseif, i really need to get the 'or' working.

Second, when writing to a file, can i write an integer variable? all i can find is fputs which only takes strings and numtostr is giving me erroneous results.

thanks in advance

frumpus
 
well... never mind. it turns out most of my problem was a result of expecting strtonum to behave like atoi. (I didn't know atoi existed and that is what i thought strtonum was for, it isn't.)

 
yes, being able to successfully convert my strings to integers allowed me to use the integers in my if statements and now the 'or's work fine. thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top