
Originally Posted by
skjsaurabh
FileConnection fc = (FileConnection)Connector.open("file:///E:/" + fileName + ".txt",Connector.READ_WRITE) ;
if (!fc.exists())
{
fc.create(); // create the file if it doesn't exist
}
fc.setWritable(true) ;
fc.setReadable(true) ;
DataOutputStream dos = fc.openDataOutputStream() ;
dos.writeUTF(value) ;
dos.flush() ;
dos.close() ;
fc.close();
// Adding File Name in RecordStore
byte [] name = fileName.getBytes() ;
rs.addRecord(name, 0, name.length) ;
System.out.println("Saved File " + fileName) ;
Sometimes it is saving files as normal readable files while at other times it is saving protected files which are unreadable and unmovable. Please tell how to solve this issue.