Hi all...I'm encountering a segmentation fault, but I can't explain it :(
I'm writing a file at receveir side in RTP.cc class, I have:

char tbuf[100];
FILE *tFile;
tFile = fopen(tbuf, "w");
fprintf(tFile,"%-16f id %-16d udp %-16d\n", Scheduler::instance().clock(),
mh->frame_pkt_id_, mh->size()-28);

and I'm getting simulation stopped with Segmentation fault(core dumped) and
my ns.exe.stackdump:

Exception: STATUS_ACCESS_VIOLATION at eip=610E1C14
eax=00000000 ebx=00000008 ecx=0022D008 edx=0022D008 esi=00000000
edi=00000000
ebp=002294C8 esp=00228C10 program=C:\cygwin\usr\local\ns-2.33\ns.exe, pid
5928, thread main
cs=001B ds=0023 es=0023 fs=003B gs=0000 ss=0023
Stack trace:
Frame     Function  Args
002294C8  610E1C14  (0022D008, 00000000, 18A2B271, 002294F8)
002294E8  610E5609  (00000000, 18A2B271, 9999999A, 3FB99999)
00229558  610935A8  (0085A3A0, 00891870, 00000000, 18910C32)
00229578  18682DAA  (0085CA70, 00891870, 00000000, 1866FC62)
002295B8  18672D2F  (00893F10, 0087D470, 00000000, 00000001)
002295D8  1866FBA1  (0083A5C8, 0087D470, 00000000, 00000000)
002295F8  1866FBA1  (00839548, 0087D470, 00000000, 610E81D6)
00229618  18683162  (0085CA70, 002298A4, 00008000, 002296A0)
00229638  1868287C  (0085CA70, 18A2B6BC, 18842E42, 002296B8)
00229658  18682E2F  (0085CA70, 00000002, 002297FC, 00000003)
00229678  1882E28A  (0085CA70, 00662340, 00000005, 002297F0)
00229828  188319C2  (0085A598, 00662340, 00000003, 00229850)
002298B8  18836C57  (0085CE78, 00662340, 00000003, 006645D0)
00229948  18837C5F  (00662340, 00000003, 006645D0, 00000000)
00229B18  18854709  (00662340, 0087D330, 00229B48, 1884D2EB)
00229B48  18853DE0  (00662340, 0087A880, 00000005, 00000000)
End of stack trace (more stack frames may be present)

If, instead writing file, I print on stdout: 

printf("%-16f id %-16d udp %-16d\n", Scheduler::instance().clock(),
mh->frame_pkt_id_, mh->size()-28);

it works fine and simulation complete.
It's very urgent...can you give me any hint?
Thanks in advance!
Rosa

-- 
View this message in context: 
http://www.nabble.com/Fprintf-and-segmentation-fault-tp23968369p23968369.html
Sent from the ns-users mailing list archive at Nabble.com.

Reply via email to