Im trying to write a config file parser which takes a line of the form SomeDirective = setting from the file and

string is implicitely convertible to char const*?

thank you d1zzy and alexs_

is that homework?

nobody can. only use a function to compare strings. right?
no. i’m trying to learning c++

learn from a book

!book

See http://jcatki.no-ip.org/fncpp/Resources#books

!give xjp acpp

Accelerated C++: Practical Programming by Example”, Andrew Koenig, Barbara Moo, Addison-Wesley, 2000. ISBN 0-201-70353-X.

thanks
but
to compare two strings
I can’t do that with string1 == string2 ?
yes I can.

!tias

Why ask? Try it and see yourself. By doing that you 1.) stop wasting our time by asking trivial questions you could answer yourself in 2 minutes and 2.) learn the answer.
bWhy ask? Try it and see yourself. By doing that you 1.) stop wasting our time by asking trivial questions you could answer yourself in 2 minutes and 2.) learn the answer./b

yes, i tried and it goes well.
well now it’s ok
thank you again alexs_ and d1zzy

np

http://rafb.net/p/tPxwt524.html

Can I #define stuff from Makefile?

(if someone’s interested in)

you can pass -DX=Y on the compiler command line

try -D

Hey… don’t know this channel… but.. would asking for a best way to approach something go against “We don’t do homework.”?

shiftplusone, nope
shiftplusone, We don’t do homework. That’s it. We didn’t say we don’t help. We just don’t *do* it.

ok awesome…. so I need to check if a given value is numeric (including decimal values) or not…. would I need to make a loop to go through each char and use isdigit then find if there is a . and…. so on?
or is there something simpler?

the given value is what? a string? char*?

shiftplusone, “345.66″ =~ /^[0-9]+\.[0-9]+$/
whoops

hehe, this isn’t #perl loop

just noticed, maybe a bit wrong channel :p

phix, think that would be a char*.

and anyway, that regex is incorrect to match both a decimal and an integer

hi everyone

uni / college assignment / homework? or school?

shiftplusone, write it to a stringstream and try reading it into a double… if the state of the stream is okay after that, it’s a numeric value

phix, uni but it’s pretty much high school level stuff.

you would probably be right just looping through it, although be careful, a char is a digit
you could include a regex library
#include regex.h

geordi, { istringstream a(“123.44″); long double b; ab; cout boolalpha a.good(); }

false

err… never mind… should work… but dunno why it doesn’t…

std

*
To prove that you're not a bot, enter this code
Anti-Spam Image

Comments are closed.