www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/01/20:07:10

Date: Tue, 1 Apr 1997 18:47:29 -0600 (CST)
From: Andrew Deren <aderen AT eecs DOT uic DOT edu>
To: deltaman AT swipnet DOT se
cc: DJGPP ML <djgpp AT delorie DOT com>
Subject: Re: String comparing problem
In-Reply-To: <33417135.1856@geocities.com>
Message-ID: <Pine.SUN.3.95.970401184256.799A-100000@bert.eecs.uic.edu>
MIME-Version: 1.0

First you try to mix pascal with C.
THe proper way to this is to use strcmp() function
if (strcmp(one_string, other_string) =3D=3D 0) {
printf("they are equal.");
}
BTW: By writing #197 do you mean extended ASCII character 197? Because
that is
the way you do it in pascal.


On Tue, 1 Apr 1997, Deltaman wrote:

> Hi!
>=20
> Thanx to all for your help with my multiple file problem. Now I've got
> another problem :)
>=20
> I have a program to exchange special HTML-letters to plain text i.e
> &#233 to =E9=82 and so on.
>=20
> In the beginner I set a string called 'test_string'
>=20
> char test_string[5] ;
>=20
> I do some other code that puts values into test_string character by
> character.
> I have a test line that prints the contents of a string to the screen.
> Its output is:
>=20
> from the lines:
>=20
> printf(test_string);
> printf("<--End of test string");
>=20
> I get the output:
>=20
> #197; <--End of test string
>=20
> When I checks if test_string is equal to a special character:
>=20
> if (test_string =3D=3D "#197; ") printf("I should see this");
> if (test_string =3D=3D "#197;")  printf("or this");
>=20
> ...nothing happens.
>=20
> What do I do wrong?
>=20
> Thanx in advance!
> ------------------------------------------------------------------------
> mailto:deltaman AT swipnet DOT se
>=20
> Please visit my homepage at http://www.geocities.com/TimesSquare/8240
> ------------------------------------------------------------------------
> ______  _______        _______ _______ _______ _______ __   _
>  |     \ |______ |         |    |_____| |  |  | |_____| | \  |
>  |_____/ |______ |_____    |    |     | |  |  | |     | |  \_|
>=20
>=20

- Raw text -


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