Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

saving an array of strings to a file

Status
Not open for further replies.

messyboy

Programmer
Nov 28, 2000
1
GB
try
{

// Show the file dialog
Handies saving = new Handies();
FileDialog fd = new FileDialog(this, "Write File", FileDialog.SAVE);
fd.setFile("");
fd.show();

// Get file name and directory.
// Remove ".*.*" from file name, if necessary

String dir = fd.getDirectory();
String file = saving.strip_stars(fd.getFile());

if (dir != null && file != null)
{
System.out.println("Writing file: " + dir + file);

// Open buffered output stream

File f = new File(dir, file);
DataOutputStream out = new DataOutputStream(
new BufferedOutputStream(new FileOutputStream(f)));

for(int i = 0; i == count; i++){
out.writeBytes(storage + "\r\n");
}



out.flush();
out.close();
}
}
catch (IOException p)
{
}

This is the code i tried and it didn't seem to go into the for loop at all how can i save this array and if this this is easy how do i open it again
 
> how can i save this array

What array?

> for(int i = 0; i == count; i++){

I have no idea what value 'count' is but if it is not 'Zero' the for loop will not execute.

Hope this helps
-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top