Hi all
i've a file sysdef.dat which looks similar to this :

temp = 43;
data = 23;
temp2 = 34;
...
and it goes on up to some values...


how do I read only the values of temp and temp2(i.e 43 & 34) from this file...
I've also tried using strtok() for separating the strings temp, 45
but i don't know how to proceed further...

Start with fgets() to read each line.

Then say strncmp() to find the temp lines.

Then see what else you can figure out.

Post code here when you're stuck.
Don't forget to read the "how to post code" threads, and code tags, and all that jazz.

post your code. I will take my time to review your code soon

An addition,
Once you've got the 1st or 3rd line using fgets() in a buffer, just go the position where the integer value starts and read the value using sscanf() with %d format specifier..
Hope this helps...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.