Copying int value from .txt file and storing it into a int variable.

kkd's Avatar, Join Date: Sep 2010
kkd
Newbie Member
hi all

iam new to c language so need a lil bit of help.

there is a file called config.txt
it contains x and y cordinates in the following format:

Quote:
xmin=0
xmax=100
ymin=0
ymax=200
i need to copy the values of all the cocordinates and store them into 4 integers variables into my program.

the problem is when i copy the value into the integer variable, ascii value of that char gets stored.
iam using the func fgetc. as iam new to c iam unable to do the convertion. i also tried typecasting.

can anyone help me with the code.
i think the code will not be long. so i wish if u can write it and explain what logic u used.

the integer values will then be passes to plenv func pf plplot lib.
0
kkd's Avatar, Join Date: Sep 2010
kkd
Newbie Member
eep: will someone come to the rescue:redface:
0
kkd's Avatar, Join Date: Sep 2010
kkd
Newbie Member
moderators admins where r u?
0
jimblumberg's Avatar
Ambitious contributor
Look into the strtok() function using the '=' as the delimiter.


Jim
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
have patience. In 2 minutes of time span you posted 3 times and instead you could have helped someone else.
0
kkd's Avatar, Join Date: Sep 2010
kkd
Newbie Member
hehe sorry for that shabbir
what can i do iam a born spammer. hve 2 lac posts in another forum but thats 3x rated
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
You will not reach double digit post count if you continue the same here.