Advertisement

WinMain Command Line String

Started by March 29, 2000 01:08 AM
2 comments, last by BlackScar 24 years, 11 months ago
Hi! I am trying to set up my game to where if you run the executable with "+windowed", it''ll go windowed... like the quake series do. But when I try testing it it doesn''t work. if( COMMANDSTRING = "+windowed") { fullscreen=false; } What''s wrong with this peice of code? Any help will be greatly appreciated. Thanks! Justin Eslinger
~-=-=-=-=-=-=~~Justin Eslinger~~.."BlackScar"..~~-=-=-=-=-=-=~
Two possible solutions....

if (COMMANDSTRING == "+windowed") //see the double equals?
or
if (strcmp(COMMANDSTRING, "+windowed")) //strcmp compares strings

in the first that will only work if COMMANDSTRING is a string type class with an overloaded == operator. If not, the second one is the probable solution.

-Omalacon
Advertisement
Ahh, thanks!

I knew about the ==, but it didn''t work the first time so I tried one =. I found the problem, though. You have to put a ! infront of it. Now everything works properly. Thanks alot!

Justin Eslinger
~-=-=-=-=-=-=~~Justin Eslinger~~.."BlackScar"..~~-=-=-=-=-=-=~
strcmp() actually compares the strings and returns the difference, where zero is no difference. Because zero is considered "false", a "!" is needed to make it "not".

/Pelle

This topic is closed to new replies.

Advertisement