troubleshooting Question

easy q about files and reading from them

Avatar of osnat
osnat asked on
5 Comments1 Solution248 ViewsLast Modified:
hello all!
i have a realy easy q:
I have an ascii file. I need to read the last line in the file (I don't know how long is that line, or any other line in the file for that matter).
after reading the line, I need to see if it's the same as my indicator (9999). the line must contain only that indicator. if not - I need to go to the prev line and do the check again, until I'll find a line that contains only 9999 or I've reached the begining of the file.
the reason for going backwords is because the file can contain several (can be a lot of) lines with my indicator, and I need to find the last line.

jhasgfg jkhfyytrwui
kags  kjhadj
kdf jgsg  hjghjgf  qkudh

when I find the last line that contains the indicator - I need to set up a file pointer to point to the line after (from there I should start writing something new).

hope to get some help

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros