File System

Hello folks,

I am writing an application in which I need to write into a file some information like:

Master file Account numberName Balance

100 Alan Jones 348.17

300 Mary Smith 27.19

500 Sam Sharp 0.00

One row for each record, again when an user require to access his accounts he may enter his account number and the related records will be fetch, thats why I want to insert each record with the help of row and column.

Here is my code for to write into a file.:

import java.io.*;

class ProgramTest

{

int a_num;

int t_amt;

publicstaticvoid main(String[] a)throws IOException

{

ProgramTest object =new ProgramTest();

BufferedWriter out=null;

try

{

File file =new File("oldmast.txt");

File file1 =new File("trans.txt");

// Create file if it does not exist

if (file.createNewFile())

{

// File did not exist and was created

System.out.println("oldmast.txt Created Successfully");

}

else

{

System.out.println("oldmast.txt already exists");

}

if (file1.createNewFile())

{

// File did not exist and was created

System.out.println("trans.txt Created Successfully");

}

else

{

System.out.println("trans.txt already exists");

}

TransactionRecord obj=new TransactionRecord();

object=obj.retrieve(object);

out =new BufferedWriter(new FileWriter("oldmast.txt",true));

out.write(String.valueOf(object.a_num));

out.write(String.valueOf(object.t_amt));

}

catch (IOException e)

{

}

finally

{

out.close();

}

}

}

What will I do to use the rows and columns kind of format, please help me out, I am relatively new in the java file system.

please help!

Thanking you all friends.

[3429 byte] By [Zorama] at [2007-11-27 11:12:38]
# 1

Huh? There is no "rows and colums" kind of format. It's all bytes, sometimes the bytes form text... You define what the file looks like by giving input to the write methods of the stream.

CeciNEstPasUnProgrammeura at 2007-7-29 13:55:57 > top of Java-index,Java Essentials,Java Programming...
# 2

Thank you Sir,

What should be the pattern to follow?

I have no idea as such, please help.

Zorama at 2007-7-29 13:55:57 > top of Java-index,Java Essentials,Java Programming...