Hi,

For a while I have been working with ns-2, but have only recently found the 
need to use file input or output operations. What I want to do is read in a txt 
file containing certain parameters for use in a protocol I am working on, but 
for some reason the fopen() command does not work.

I am using the following to check whether it has been read:

FILE *conf = fopen("test.txt", "r");
                if(!conf)
        {
                printf("Error opening file");
        }

The test.txt file is located in the same directory as the code, so it is not in 
a different directory.

This always returns my error message. When I copy this code and the test.txt 
file to another directory outside of ns-2 and compile and run it as a 
stand-alone application it opens the file without any problems.

I am wondering whether anyone else has similar experience with this.

Regards,

Fraser

________________________________
Fraser Cadger (PhD Student)
Intelligent Systems Research Centre
University of Ulster (Magee)
Northland Road
BT48 7JL

Room MS216, Desk 48

Telephone: +44 (0)28 716 75173
Website: http://isrc.ulster.ac.uk/staff/FCadger/Contact.html

Reply via email to