Revision as of 05:01, 8 April 2012 by Song110 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Lecture 23 _4/5_Kailu Song

Review for exam 2,students could ask question 1.read file FILE *fptr;

fptr = fopen(filename,"rb");

int a;

double b;

fread(&a,sizeof(int),1,fptr);

fread(&b,sizeof(double),1,fptr);

Person P;

fread(&P,sizeof(Person),1,fptr);

int arr[10];

fread(arr,sizeof(int),10,fptr);

int ch;

ch = fgetc(fptr);

char = oneline[256];

fets(oneline,256,fptr);

(stop at '\n', or reach the limit'\o');

int a,b;

fscanf(fptr,"%d %d", &a,&b);

strlen not include '\o';

strcpy,strstr,strcat;

2.linklist with n nodes sorted,insert one more value

3, three outcomes:1.file;2.structure;3.dynamic structure(linked list);

Alumni Liaison

Followed her dream after having raised her family.

Ruth Enoch, PhD Mathematics