linked list

A

angelayoub

i wanted to register the content of the linked list i have created in a
file,but unfortunately i couldn't register it,and i was wondering if
someone would mind helping to solve that problem or giving me any idea.
 
M

Michael Mair

angelayoub said:
i wanted to register the content of the linked list i have created in a
file,but unfortunately i couldn't register it,and i was wondering if
someone would mind helping to solve that problem or giving me any idea.

Give us the minimal code that does not work so we can help you.
For I/O functions see <stdio.h>, especially fopen(), fclose(),
fwrite()/fread() or fprintf()/fscanf().
register is a C keyword and probably has nothing to do with what
you have in mind...
Note that storing pointers in files does not make much sense, so
you should not store the linked list nodes as they are.

Most of us will not do your homework.


Cheers
Michael
 
D

Default User

angelayoub said:
i wanted to register the content of the linked list i have created in a
file,but unfortunately i couldn't register it,and i was wondering if
someone would mind helping to solve that problem or giving me any
idea.


I am going to assume you mean "save" rather than "register". It's
really not that difficult, as long as you realize that you don't save
pointers. Just walk the list from head to tail, save the data in some
sort of format. If the data members happen to be structs or pointers to
some sort of object, you'll have to figure out a way to represent that.

Then you rebuild the list from the saved off data.

Show us what you have so far, then we will help you fix problems.
Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,148
Messages
2,570,838
Members
47,385
Latest member
Joneswilliam01

Latest Threads

Top