#include <stdlib.h>
typedef struct LinkedList_st{
int key
struct LInkedList_st * next
}LinkedList
int writeList(const char* path,LinkedLIst* lst){
if(lst==NULL) return -1
FILE* file = open(path,'w+')
if(file==NULL){
printf("open file failed!")
return -1
}
LinkedList* ptr = lst
while(ptr!=NULL){
fprintf(file,"%d\n",ptr->key)ptr=ptr->next
}
close(fp)
return 1
}
随手写的,应该没错吧!自己调试下!