From: "Clint Allen" Newsgroups: comp.os.msdos.djgpp Subject: C command line options Lines: 49 Message-ID: Date: Wed, 27 May 1998 08:56:02 GMT NNTP-Posting-Host: usr7-dialup50.mix1.bloomington.mci.net NNTP-Posting-Date: Wed, 27 May 1998 04:56:02 EDT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Anyone who can help on this? I am trying to use command line options in my program. Here's what I've got so far: int main(int argc, char* argv[]) { // Declare/init. variables int title_on; // Command line option procedure if (argc == 1) { title_on = 1; } else { if (argv[1] == "/nts") title_on = 0; else if (argv[1] == "/?") { puts("Command line options"); puts("-----------------------"); puts("/? Display this list"); puts("/nts No title screen"); return 0; } else { puts("Invalid command line option. Use \"/?\" to see valid options."); return 0; } } The problem is that whenever one of the valid options is entered, the comparison statements (such as--if (argv[1] == "/nts")) don't work. In other words, even though argv[1] DOES equal "/nts", the program goes past the "if" statement as if it didn't. Am I overlooking the obvious here, or is my compiler screwed? BTW, I'm using DJGPP & RHIDE. All help is greatly appreciated. __________________________________________________________________ Clint Allen clint DOT allen AT mci2000 DOT com ICQ UIN: 8662422 (Get ICQ at: http://www.icq.com/download) "Religion is the opiate of the masses." -- Carl Gustav Jung __________________________________________________________________