Reading Fixed Length Record File

C

cksanjose

Hi everyone!

I have to read a text file with fixed length record. The file can be in
2 formats. The first one has linefeed terminator for each record. The
second format does NOT have a linefeed.
What would be the best way of reading this text file.

Thanks,
Cesar
 
A

Andrew Thompson

cksanjose wrote:
....
I have to read a text file with fixed length record.

All of it? Or just parts?
..The file can be in
2 formats. The first one has linefeed terminator for each record. The
second format does NOT have a linefeed.
What would be the best way of reading this text file.

Depends on things you didn't mention.

e.g. If it's a) from above, I'd tend to use a line reader..
if b) a RandomAccessFile.

Andrew T.
 
B

Brandon McCombs

Andrew said:
cksanjose wrote:
...

All of it? Or just parts?


Depends on things you didn't mention.

e.g. If it's a) from above, I'd tend to use a line reader..
if b) a RandomAccessFile.

Andrew T.

He didn't mention them but it seems that you did just fine being able to
answer his question by giving him the options he has so what's the big
deal? If you couldn't answer him at all then I could see it as being a
problem but if his information wasn't preventing you from helping him,
and in this case it wasn't, then why complain that he didn't mention
something?

While writing a post someone can't necessarily think of every single
piece of information they need to include in order to get a response
from someone else, or they may leave out info that they think isn't
pertinent, or give too much information. Whatever the case is there
isn't any need to point it out unless it detracts from the advice that
is given. You still gave him advice that covers his problem so if he
didn't specify everything up front, so what?
 
L

Lew

Brandon said:
He didn't mention them but it seems that you did just fine being able to
answer his question by giving him the options he has so what's the big
deal? If you couldn't answer him at all then I could see it as being a
problem but if his information wasn't preventing you from helping him,
and in this case it wasn't, then why complain that he didn't mention
something?

While writing a post someone can't necessarily think of every single
piece of information they need to include in order to get a response
from someone else, or they may leave out info that they think isn't
pertinent, or give too much information. Whatever the case is there
isn't any need to point it out unless it detracts from the advice that
is given. You still gave him advice that covers his problem so if he
didn't specify everything up front, so what?

As I read Andrew's post, his questions *are* part of the advice. He's helping
the OP by giving examples of questions the OP can ask themself, which
questions will empower the OP to achieve answers independently, thus improving
the OP's skills. If Andrew had spoon-fed the answers without giving the
reasoning behind them, the OP would not have benefited as much.

It is well-established good practice to think through a programming (or any
engineering) problem in detail. By encouraging folks to do that, Andrew is
helping them. It's also more effective at getting useful answers on Usenet to
phrase one's questions thoroughly and precisely.

"Build a man a fire, you warm him for an hour.
Set a man on fire, you warm him for the rest of his life."

- Lew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top