From: Andy Bober Newsgroups: comp.os.msdos.djgpp Subject: Re: DJGPP inconsistencies? Date: Thu, 13 Mar 1997 08:30:43 -0600 Organization: Educational Computing Network Lines: 39 Message-ID: <33280F93.B9B@uxa.ecn.bgu.edu> References: NNTP-Posting-Host: modem15.wiu.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp [snip] > > Also, I sometimes get random compiler "parse" errors when I include > > the following code in a program: > > > > char *str; > > if ( (str = getenv("DEM_PATH")) == NULL) { > > printf("\"DEM_PATH\" environment variable not set\n"); > > exit(1); > > } > > > > Yet again...WHY? > [snip] It's your nested double quotes. How many strings are in the printf() line? Parse of printf() string: "\" --- this starts and ends one null terminated string DEM_PATH\ --- this is a syntax error " environment variable not set\n" --- this starts and ends a second null terminated string Try the line like this: char *str; if ( (str = getenv("DEM_PATH")) == NULL) { printf("'DEM_PATH' environment variable not set\n"); exit(1); } If you need to use the the backslashes as characters in the string, I believe they must be doubled. ( ie. "\\DEM_PATH\\ environment variable not set\n" ) Andy