c - Read a text file line by line and save each line in the buffer irrespective of data type and length of each line -
i want read 1 line of text file, save buffer, send buffer on udp socket , go , read second line , on..
so far, since knew data type of text read text file, had been using
fscanf()
to read each line text file. don't know data types not possible me use function anymore. there other way read text file line line.
note: the length of each line may vary.
here handy code found read data binary
file *fp; fp=fopen("c:\\test.bin", "r"); char *x = new char[10]; //size_t fread(void *ptr, size_t size_of_elements, size_t number_of_elements, file *a_file); fread(x, sizeof(x[0]), sizeof(x)/sizeof(x[0]), fp);
Comments
Post a Comment