[ns] FILE * producing segmentation fault

Meeta Gupta meeta.gupta at yahoo.com
Sun May 24 11:35:57 PDT 2009



--- On Sun, 5/24/09, Meeta Gupta <meeta.gupta at yahoo.com> wrote:


From: Meeta Gupta <meeta.gupta at yahoo.com>
Subject: FILE * producing segmentation fault
To: ns-users at isi.edu
Date: Sunday, May 24, 2009, 11:34 AM










hi users,
 
                 please help me with this problem. i am trying to implement a new agent. i have a method that is periodically invoked to write some statistics in a file. whenever i try to print something in the text file using fprintf i get a segmentation fault. anything without the file pointer seems to work. i have the following lines in my c++ code....
 
void myAgent:: print_info()
{
       FILE * fp;
       fp = fopen("/Documents/ns-allinone-2.31/text.txt", "a");
       fprintf(fp, "something")     ; //////////causes segmentation fault
 
}
thanks
 
meeta



      


More information about the Ns-users mailing list