Strings and Linked List 
Author Message
 Strings and Linked List

Hi All,
I am new to the C Programming language and I'm having trouble understanding
how to use Linked List and strings. For example, I 'm not sure how to set up
the list to hold the contents of a text file. I can open the file, send it
to another file, but I don't quite understand how to use the Linked list
construct to access different parts of the text file.
I'd like to be able to scan through the file and print out information from
a particular part of the file, and not the entire file's contents. Would
anyone care to point me in the right direction? Thanks.


Sun, 07 Mar 2004 22:42:49 GMT  
 Strings and Linked List

Quote:

> I'd like to be able to scan through the file and print out information from
> a particular part of the file, and not the entire file's contents. Would
> anyone care to point me in the right direction? Thanks.

What is an item in your Linked List supposed to contain? A line of text?

--
== Eric Gorr == http://www.*-*-*.com/ :9293199 ===
"Therefore the considerations of the intelligent always include both
benefit and harm." - Sun Tzu
== Insults, like {*filter*}, are the last refuge of the incompetent... ===



Sun, 07 Mar 2004 23:03:55 GMT  
 Strings and Linked List
Yes, the text reads - LIN_ADV A, COL_ADV 21. The (LIN_ADV) represents a
range of lines from A-I, and (COL_ADV) represents a range of columns from
1-44.

Quote:

> > I'd like to be able to scan through the file and print out information
from
> > a particular part of the file, and not the entire file's contents. Would
> > anyone care to point me in the right direction? Thanks.

> What is an item in your Linked List supposed to contain? A line of text?

> --
> == Eric Gorr == http://www.*-*-*.com/ :9293199 ===
> "Therefore the considerations of the intelligent always include both
> benefit and harm." - Sun Tzu
> == Insults, like {*filter*}, are the last refuge of the incompetent... ===



Sun, 07 Mar 2004 23:43:04 GMT  
 Strings and Linked List

Quote:

> Yes, the text reads - LIN_ADV A, COL_ADV 21. The (LIN_ADV) represents a
> range of lines from A-I, and (COL_ADV) represents a range of columns from
> 1-44.

Well, if I am interpreting your comments correctly, a line of text
should be in each element of your linked list. I also assume that the
first element in your linked list would be the first line of the text
file.

To read a line of text from a file, you will want to take a look at the

  fgets

function. Each time you read a line in, you can create a new linked list
element, containing that line and append it to the end of your linked
list.

Why don't you post the code you have written for us to stare at. With
some actual code, we can better point you in the proper direction.

--
== Eric Gorr == http://www.*-*-*.com/ :9293199 ===
"Therefore the considerations of the intelligent always include both
benefit and harm." - Sun Tzu
== Insults, like {*filter*}, are the last refuge of the incompetent... ===



Sun, 07 Mar 2004 23:50:49 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. link list of a linked list (chained links?)

2. Incompatible NULL Assignments || Linked List inside Linked List

3. Clearing Memory || Linked List INSIDE of a Linked List

4. Freeing a Linked List inside of a Linked List

5. Linked List of Linked Lists

6. Define a linked list of a linked list

7. Link List to Link List, HELP friends

8. problems with a string linked list program and pointers

9. Problems with linked lists and strings (char *)

10. Linked list of strings...?

11. linked lists (searching/moving a link)

12. link list - add a link at the head of the list.

 

 
Powered by phpBB® Forum Software