string to integer conversion

S

syntax

hi i have a simple question.

question1
-----------
i have a string

char string[20] = "114 145";

i simply want to extract two integers from it i.e i want 114 and 145
..

how can i do it??

i write in C

question2
-----------

suppose i have a file like below

file
----

$123 124$ 125 146 $145 164$ 12 3 4 ....like this

i want to read from the file such a way that whenever i found a
starting "$" and a ending "$" , the content in between i want to store
in a string.

that is, in this example my string will be

char str1[10] ="123 124"
and
char str2[10]="145 164"

how do i read from the file...can you tell me the syntax.

other data i want to read as integers.

thanks
 
A

Aggro

syntax said:
how can i do it??

i write in C

If you are asking about C, why are you not asking them in comp.lang.c?
You do know that C and C++ are two different languages, don't you? Or
did I misunderstood you?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top