CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Linked Lists

  1. #1
    Guest

    Linked Lists

    How would I read data from a file into a linked list while keeping it in the same order?


  2. #2
    Join Date
    Apr 1999
    Posts
    13

    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
  •  





Click Here to Expand Forum to Full Width

Featured