• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to read line by line  RSS feed

 
Sham Jowsaki
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I hv .txt file and am reading the file through FileInputStream.
.txt file like
WYC911 21001858 xyz 1.00
WYC912 21001858 abc 1.00
WYC913 21001858 cde 1.00
I am able to read the txt file and getting the first line of the file and checking condition if input is (WYC911) doing some process. While am checking the second line value (WYC912) then the string contains both first and second line. So I unable to do process.
I need to check the input value in each and every line of the text file.
Pls advise me how to achieve my task..
Tks in advance..
jowsaki
 
Ellen Zhao
Ranch Hand
Posts: 581
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sham,
you may try the code below. Just do some modify to meet your specification.


Regards,
Ellen
[ January 14, 2003: Message edited by: Ellen Fu ]
[Rewrote really long lines to wrap - Jim]
[ January 15, 2003: Message edited by: Jim Yingst ]
 
Ellen Zhao
Ranch Hand
Posts: 581
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I�m sorry for the ugly code format, but I just copied the code from the fourth post of this thread and then pasted it here. I did some re-edit but...finally could not figure out where should I break line and insert white space properly. You may have a look at the original code in that thread.

Regards,
Ellen
 
Sham Jowsaki
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[repetitious code deleted - Jim]
Regards,
Ellen
[ January 14, 2003: Message edited by: Ellen Fu ][/qb]<hr></blockquote>
Thanks a lot. Let me try and get back to you.
Jowsaki
[ January 15, 2003: Message edited by: Jim Yingst ]
 
Sham Jowsaki
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot. Let me try and get back to you.
Jowsaki
 
Sham Jowsaki
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ellen,
Thanks a lot.. it is working kool.
Takecare
jowsaki
 
Sham Jowsaki
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ellen,
I would like to ask you one more thing is that
I wanna call this text file and keep it as memory or stack, irrespective of calling everytime.
Pls advise me how to do.
Thanks
jowsaki
 
gautham kasinath
Ranch Hand
Posts: 583
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Though this seems a bad idea.. esp. if your file size is gonna grow..
Define your own file object.. and have the lines in it.. and keep the object in memory.. as long as your application is up and running..
Lupo
 
Ellen Zhao
Ranch Hand
Posts: 581
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wanna call this text file and keep it as memory or stack, irrespective of calling everytime.

Sorry Sham, it�s a shame that I have no idea--even don�t quite understand your specification. See whether there are any IO experts here

Good Luck,
Ellen
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!