delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/28/09:21:06.1

Message-Id: <199907281320.JAA24759@delorie.com>
From: "Dan Gold" <TedMat AT CoastNet DOT com>
To: <djgpp AT delorie DOT com>
Subject: Detecting a 0 and also a letter in atoi()
Date: Tue, 26 Jan 1999 21:37:36 -0800
X-MSMail-Priority: Normal
X-Priority: 3
X-Mailer: Microsoft Internet Mail 4.70.1155
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

Could be offtopic, but It I want to detect if there is a letter in my
character boxes but atoi returns zero if there is a letter. This is poorly
designed because I can't use the number 0 when converting the integer
string to an int variable. I thought this would work but it didn't so could
anyone type some code to do so?

if (((t_box_r == "0") || ((color.r == atoi(t_box_r)) != 0)) &&
    ((t_box_g == "0") || ((color.r == atoi(t_box_g)) != 0)) &&
    ((t_box_b == "0" || ((color.r == atoi(t_box_b)) != 0))) {

 do stuff!!!!!....

}

Thanks, for the help, I think there is a better way to structure the
conditionals but it's got me...

from Dan Gold

            -=-=[CATACOMB ABYSS]=-=-
http://www.geocities.com/SiliconValley/Port/1547/

- Raw text -


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