That is just about strcpy itself. How can I use this to insert string to the struct?
Type: Posts; User: timgao
That is just about strcpy itself. How can I use this to insert string to the struct?
inside struct I need to have :
struct node {
char *string;
struct node *next;
};
can you give me some more details about strcpy(structure I can find out)?
I mean where shall I use it?
I found out the problem above, I don't know why but the code works fine on another compiler.
A new question how to insert string into a list.
I tried numbers. It's fine. but not with string.
...
I do not quite get your point. you say I have a \n in the line. I think so too. It's at the end of the line. Am I supposed to have it in the line? I think I need \n for fgets to find out the line....
strcspn(token, " \n"); works fine.
that is my question what's wrong with " "
I have got some new problems while search for \n in the text
the code works fine but it does not work when I change "\n" to " ".
text file is still the same.
name1 telephone1 1
name2...
Thank both of you I will give a try. See if I have any more questions later.
so look for space every time but how can I move to the next node? look for \n?
the text file looks like:
Name telephone seetnumber \n
Name telephone seetnumber \n
Name telephone seetnumber \n
code for loading file
int fileSize(char* filename) {
I know that. but how can I find out different names the file is just a piece of text. I do have spaces and \n in the text but How to really get them out and put into the right node.
I have a list of names in the file. I want to load it into a struct list every time before I insert any new names.
I can only load the data into an array how can I put it into list nodes?