[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Q] Tracefile Conversion
Have a look at:
http://www.research.att.com/~breslau/vint/trace.html
It has a pointer to a C program that does the ascii to
binary conversion. The reverse conversion should be a
pretty simple modification.
Lee
From: "Lee Jiwoong" <[email protected]>
To: <[email protected]>
Subject: [Q] Tracefile Conversion
Date: Wed, 17 Nov 1999 01:06:59 +0900
(Unknown charset: <ks_c_5601-1987>)
Dear Seniors
I'm trying to convert ~ns/tcl/ex/example-trace to normal ascii file.
Below code is my first workout, and it seems not working. The result is so big.
(first field is time and next field is size)
What's wrong ?
And If you have converter programs(that is, from ascii to bin and bin to ascii)
can I have a copy of it ?
Thanks
======[code]==========
#include <stdio.h>
#include <sys/types.h>
#include <netinet/in.h>
int main(int argc, char *argv[])
{
unsigned int time;
unsigned int size;
int pos;
FILE *file;
file=fopen(argv[1],"r");
for(pos=0;pos<10;pos++)
{
fread(&time,4,1,file);
fread(&size,4,1,file);
printf("%10u %10u\n",htonl(time), htonl(size));
}
}
=====[result]===========
porce.kaist.ac.kr porce:/home/porce> gcc x.c -o x ; x e | more
1937006962 2002874995
8847700 21233971
21758263 22544703
21954895 19923296
18153799 20578610
19792204 19792198
19595607 19267889
21823771 20578606
19398949 28967425
65 620757129
=====================