D&C Lug - Home Page
Devon & Cornwall Linux Users' Group

[ Date Index ][ Thread Index ]
[ <= Previous by date / thread ] [ Next by date / thread => ]

[LUG] Quick C question



How do I parse this string:

ITEMNAME="245"

into 
char string[10]
containing ITEMNAME and
int value = 245;

?

The string is read in from a file using ifstream and I can't get strcmp to 
match the " marks - when I try to:
strcmp(buffer,"ITEMNAME=\"245\"")
I don't get a match.

It is (slightly) Linux related, as I'm using g++ to try to get this 
working!!! (The final application with be cross-platform on Windows - MS-DOS 
actually - and Linux (console) so I need to stick to stdlib.h and similar 
functions.)


-- 

Neil Williams
=============
http://www.codehelp.co.uk
neil@xxxxxxxxxxxxxx
linux@xxxxxxxxxxxxxx
neil@xxxxxxxxxxxx


--
The Mailing List for the Devon & Cornwall LUG
Mail majordomo@xxxxxxxxxxxx with "unsubscribe list" in the
message body to unsubscribe.


Lynx friendly