/* USAGE: binary_read_file.out must have first column equal to time difference between probes and second column as size of packets in bytes. */ #include int main(int argc, char* argv[]) { int size, time, status; float time_input,size_input; FILE* fp; FILE* fp1; fp = fopen(argv[1], "w"); fp1 = fopen(argv[2], "r"); /* printf("Enter time and size pairs\n");*/ while ( (status = fscanf(fp1,"%f %f", &time_input, &size_input)) != EOF) { time=(int)(time_input); size=(int)(size_input); /* printf("%d %d \n",time,size);*/ time = ntohl(time); size = ntohl(size); fwrite(&time, 1, sizeof(int), fp); fwrite(&size, 1, sizeof(int), fp); } fclose(fp); fclose(fp1); }