0

So basically I have this file that my program needs to open called "outfile.txt" and "fort.20.txt". In windows, I have the file located at the root of the C:\\ drive, and the program compiles perfectly. My program goes to the directory like this:

File textfile1 = new File("C:\\outfile.txt");
File textfile2 = new File("C:\\fort.20.txt");

The thing is, my program needs to work on linux as well(Ubuntu specifically). I have a directory on a linux computer called "/home/lcoy" - that is where I would like my files to be stored while running the program on linux. Would I go to the directory just like I did on windows? I imagine it would be something like this:

File textfile1 = new File("/home/lcoy/outfile.txt");
File textfile2 = new File("/home/lcoy/fort.20.txt");

Can someone tell me if this is the proper way to refer to the file directory on a linux system? Thank you for your help.

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by dupowdis
0

Do you have a linux system available?
Compile and test your code there to see what works.

Let us know how you do.

0

Do you have a linux system available?
Compile and test your code there to see what works.

Let us know how you do.

I have a solaris right here, as a matter of fact. Ill report back when I try it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.