0

I try to read a file and display the data on the TextField.
But it does not read the next line.
For example, for two lines,

How are you? Long time no see.
I remember you.

The program does not show the sentence "I remember you"
How should i do that?

try {
			
			
			fileconnection=(FileConnection)Connector.open(path+filedir);
			InputStream is=fileconnection.openInputStream();
			ByteArrayOutputStream baos=new ByteArrayOutputStream();
			byte[]buffer=new byte[1024];
			int bytesRead=0;
			while((bytesRead=is.read(buffer))!=-1)
			{
				baos.write(buffer,0,bytesRead);
				TFileReadWriteMIDlet.tfilereadwritemidlet.mainform.txtfield.setString(baos.toString());
			}
			
			//TFileReadWriteMIDlet.tfilereadwritemidlet.mainform.txtfield.setString(baos.toString());
		
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by bluebird
0

yes. The program reads the second line " Long time no see"
The program reads until the next line.
How should I do that?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.