Results 1 to 5 of 5
Thread: Text file extension?
- 05-13-2011, 08:03 PM #1
Member
- Join Date
- Apr 2011
- Posts
- 16
- Rep Power
- 0
- 05-13-2011, 09:39 PM #2
Where is the file? Is it in the current directory?
One way to find the current directory is to open a file for output and see where it is written.
I'm sure there is a faster/easier way but I don't have it available right now.
- 05-13-2011, 09:53 PM #3
Member
- Join Date
- Apr 2011
- Posts
- 16
- Rep Power
- 0
No the program works fine with the first code i have shown, i just wanted to know if theres anyway to shorten the file extension to just "Question.txt" instead of the longer version, its just if i was to move the program to say another hard drive i would have to go back and change the file extension in the program, oh yeah and the question.txt file is in the root of the program.
- 05-13-2011, 10:03 PM #4
It's often better to use a relative path vs the full path.
You didn't say if you wrote a test program to find where a file would be if you wrote it without any path.
Try that and see.
- 05-14-2011, 12:20 AM #5
Senior Member
- Join Date
- Jun 2008
- Posts
- 339
- Rep Power
- 5
If the program and file might be moved independently, the thing to do would be to pass in the current location of the file to your program as a parameter when you run it.
Otherwise, if they're always in the same relative position but the drive letter changes, use a relative path as Norm suggested.
Similar Threads
-
Image File Extension Regular Expression
By kagster in forum New To JavaReplies: 1Last Post: 02-15-2011, 05:30 PM -
File Extension Filter
By heartysnowy in forum New To JavaReplies: 9Last Post: 10-09-2010, 01:33 PM -
save file based on file extension
By masa in forum AWT / SwingReplies: 4Last Post: 05-11-2010, 11:17 AM -
how to save Interface (file extension)
By shaggyoo7 in forum New To JavaReplies: 9Last Post: 01-10-2009, 09:07 AM -
Regex for file extension
By gapper in forum New To JavaReplies: 1Last Post: 01-31-2008, 03:59 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks