Solved

RandomAccessFile.readLine() has carriage return

Posted on 1998-10-22
3
654 Views
Last Modified: 2012-05-04
i am using RandomAccessFile.readLine(); to read from a text file. each string it reads has a Carriage Return (0d hex) as the last character.

to get rid of it, i copy all but the last chararcter into new string:

tempString = file.readLine();
imageFile[i] = tempString.substring (0, tempString.length() - 1);

this isn't real pretty.
is there a better way to get what i want?
0
Comment
Question by:jdaues
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
msmolyak earned 50 total points
ID: 1226156
Use BufferedReader.readLine() instead.
0
 
LVL 5

Expert Comment

by:msmolyak
ID: 1226157
That is

BufferedReader br = new BufferedReader(new FileReader(filename));
String line;
while ((line = br.readLine()) != null)
{
.
}
0
 

Author Comment

by:jdaues
ID: 1226158
that seems to work, thanks!

0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
type mismatch (Object[] to double[] 4 41
Java Eclipse Loop 3 31
restrict decimal places for double datatype 10 34
Coding for the first time 9 70
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
In this post we will learn different types of Android Layout and some basics of an Android App.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This video teaches viewers about errors in exception handling.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question