delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/02/01:29:58

From: Skye <s_c AT iname DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: String comparing problem
Date: Tue, 01 Apr 1997 16:33:33 -0800
Organization: Uniserve
Lines: 22
Message-ID: <3341A95D.1172@iname.com>
References: <33417135 DOT 1856 AT geocities DOT com>
Reply-To: s_c AT iname DOT com
NNTP-Posting-Host: dy2-13.van.tvs.net
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Deltaman wrote:

> 
> if (test_string == "#197; ") printf("I should see this");
> if (test_string == "#197;")  printf("or this");
> 
> ..nothing happens.

Are you using that exact syntax?
Strings in C can't be compared using the == operator
you would have to use a function like strcmp(string1,string2); from
string.h. or write your own symbol parser. The advantage of writing your
own parser is that you have the chance to optimize it directly to your
needs.

mail me if you need any more help.
This is a C question and should be posted to another NG
news:comp.lang.c.moderated
is usually a good one.


-SC

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019