ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
(in C++)
Ok this may be tricky in understanding but here goes.
I have a txt file that has unknown # of lines of txt. Each line has the format:
"String;String;int;float" (the quotes are not there)
I use the types but there are actual words an numbers in the lines. What i need to do is read in the file, let the user specify which lines to group together to form a graph from the numbers given.
Ex;
...
Word1;Word2;3;.5
word2;Word3;4;.6
Word1;Word3;3;.4
...
If the user puts the range from (int) 2-3 and from (float) .5 - .6. The only line to place in a graph is the first line. The graph is only graphing the strings.
What im not understanding how to do is read the file and let the user specify which lines to graph. (I am in planning so no code has been written. I do not know how to read a txt file in C++ where im able to to do this)
What i have figured was that i:
Read the file
Prompt the user for a range of ints and floats
Search through the file for the lines within the range specified from the user
use those lines to graph the strings
PLEASE HELP
Last edited by boredmuch; 04-17-2011 at 09:17 PM.
Reason: forgot a line
To fread a file, you need to fopen it. You can traverse the file by fseek, and also fwrite it. And in the end, fclose is a must. Google the bold words.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.