Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Copying int value from .txt file and storing it into a int variable. (http://www.go4expert.com/forums/copying-int-value-txt-file-storing-int-t23444/)

kkd 29Sep2010 15:42

Copying int value from .txt file and storing it into a int variable.
 
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.:confused:
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.

kkd 29Sep2010 16:05

Re: Copying int value from .txt file and storing it into a int variable.
 
:peep: will someone come to the rescue:redface:

kkd 29Sep2010 16:07

Re: Copying int value from .txt file and storing it into a int variable.
 
moderators admins :p where r u?

jimblumberg 29Sep2010 18:32

Re: Copying int value from .txt file and storing it into a int variable.
 
Look into the strtok() function using the '=' as the delimiter.


Jim

shabbir 29Sep2010 18:53

Re: Copying int value from .txt file and storing it into a int variable.
 
have patience. In 2 minutes of time span you posted 3 times and instead you could have helped someone else.

kkd 30Sep2010 10:33

Re: Copying int value from .txt file and storing it into a int variable.
 
hehe sorry for that shabbir;)
what can i do iam a born spammer. hve 2 lac posts in another forum;) but thats 3x rated:blush:

shabbir 30Sep2010 10:48

Re: Copying int value from .txt file and storing it into a int variable.
 
You will not reach double digit post count if you continue the same here.


All times are GMT +5.5. The time now is 04:45.