468,513 Members | 1,763 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,513 developers. It's quick & easy.

how to use struct function

how to use struct function as it pertains to reading data from a file and storing it ?
Oct 13 '06 #1
2 3240
Banfa
9,056 Expert Mod 8TB
There is no such thing as a "struct function", please be clearer in your question.
Oct 13 '06 #2
D_C
293 100+
How can he use a function to read data from a file into a struct?

Pass by reference a data structure to read in the data, and pass by value/reference a string or some way to identify the file to read. You may want to return a boolean value, true if everything went alright, false if something went wrong.

I'll put the very basics. I can't get too specific unless you give an example of the data and how it should be parsed.

Basics:
In the function, open the file for reading.
Figure out how to parse the data.
Take each line and store it appropriately in the data structure.
Close the file.
Oct 13 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Bryan Parkoff | last post: by
4 posts views Thread by Angus Comber | last post: by
19 posts views Thread by Russell Shaw | last post: by
5 posts views Thread by Johs32 | last post: by
5 posts views Thread by Bill Pursell | last post: by
4 posts views Thread by Michael Brennan | last post: by
28 posts views Thread by Bill | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.