|
-
April 19th, 1999, 11:43 PM
#1
Linked Lists
How would I read data from a file into a linked list while keeping it in the same order?
-
April 20th, 1999, 09:14 AM
#2
Re: Linked Lists
I guess you have to get the file data using the string tokens one by one and store that in the LinkedList...
that would be in the same order... if you want the code let me know ... ;-)
here is the sample algorithm
Open the File...provided the data in the file would be like ... say
samar samar samar samar samar samar samar ( with space as delimiter or any other key)
then
call GetLine() and store it in the buffer,
using tokens like
char* token ;
token = strtok(buffer," "); // you can get each word saperately....
the push that token in the strcpy(Link->data, token);
i guess this is it....
if you want full fledge code then let me know ..... ;-)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|