Results 1 to 3 of 3
- 03-12-2014, 11:48 PM #1
Senior Member
- Join Date
- Sep 2012
- Posts
- 108
- Rep Power
- 0
Remember File Structure on subsequent openings
I have a program I am working on, and have been using the following code:
Java Code:private void checkQInstall(){ try { qs = new File("C:\\MEMORYGAME\\q.bin"); in = new BufferedReader(new FileReader(qs)); } catch (FileNotFoundException e) { System.out.println("CALLED"); dir1 = new File("C:\\MEMORYGAME\\"); dir1.mkdirs(); try { out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("C:\\MEMORYGAME\\q.bin"))); } catch (FileNotFoundException e1) { System.out.println("FAILED TO CREATE FILE STRUCTURE"); System.exit(0); } } }
Last edited by rru96; 03-12-2014 at 11:51 PM.
- 03-12-2014, 11:58 PM #2
Re: Remember File Structure on subsequent openings
You can find the directory where the program is started from using System.getProperty("user.dir"). From there you can build your paths.
"It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2™ © 2013
- 03-13-2014, 12:20 AM #3
Senior Member
- Join Date
- Sep 2012
- Posts
- 108
- Rep Power
- 0
Similar Threads
-
copying file from one folder to another maintaining the file structure in java
By rahggupt in forum New To JavaReplies: 0Last Post: 11-12-2011, 02:26 PM -
data file structure
By Nicholas Jordan in forum Advanced JavaReplies: 2Last Post: 01-07-2009, 05:16 AM -
writing/reading a Structure to/from a file
By Farzaneh in forum New To JavaReplies: 1Last Post: 08-31-2008, 03:21 PM
Bookmarks