Read Unix file with Powerbasic 6.0

How can I read LINUX/UNIX text file who has only Linefeed (LF) as terminator not Linefeed/Carriage return (CRLF) as Powerbasic uses ?

soffcecManagerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

d4durveshCommented:
refer this,

http://www.cplusplus.com/forum/windows/28103/2/


hope it help you..:-)
0
TommySzalapskiCommented:
Um, that's C++ not Powerbasic.

If you want to open the file using Powerbasic, just open it as a BINARY instead of a READ file.
http://www.powerbasic.com/support/help/pbcc/open_statement.htm
Then you can read in the file one character at a time and when you get to a character with a value of 13, that's the LF character.
0
soffcecManagerAuthor Commented:
I am reading files who are more than 1 Gb. in size with few millions records. I think open and read as binary  will take to long time. Today I read the whole file and replace LF with CRLF with "REPLACE $LF with   $CRLF"   and then I write it out again, then after I can read it in record for record. I am looking for more simple way to do this.
0
TommySzalapskiCommented:
There is no way to open sequential LF delimited files in PowerBasic. If you use C++ (getline) or VisualBasic (readline), then you can have it read up to LF not just CRLF.
If you must use PowerBasic, then your only option is to read it in as binary and find the LF characters (which are 10, not 13, my mistake. CR is 13, LF is 10). Or of course to modify the Input file as you have done.

Unfortunately, Powerbasic is fairly limited so those are your only options. To summarize, your options are:
Use a different language
Open in binary
Modify input file
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TommySzalapskiCommented:
I don't think reading as binary is any slower. In either case you or the background code needs to find the line terminating character. If the compiler optimizes properly, they should run at the same speed (just take some extra work programming).
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Programming

From novice to tech pro — start learning today.