hi all
i need a code for reading only numbers from file and not the
letters.
for ex if i have emp name and salary i have to reda only salary.
The code to read data from a file always depends on how the file is
organized and you haven't told us that.
A standard text file (sometimes called a "flat" file), is usually
organized into lines that end with carriage returns and/or line feeds.
To read a file like this, you open the file, wherever it is, then use a
loop to read the file one line at a time until there are no more lines,
then you close the file. As you read each line, you parse it, i.e. you
analyze it and grab the parts that you want and ignore the parts you
don't want.
But many files are not organized this way and need different techniques
to read them. For example, a zip file is a more complex file: it is a
file that contains other files. And a binary file, like a JPEG or MP3,
is also organized different from a text file.
Therefore, your question isn't answerable: it doesn't give any
information about the organization of the file. If it is a standard
format, please state what format it is. If it is not a standard format,
can you post a few lines of it? Then, maybe, we'll be able to figure
out what it is so that we can advise you on how to read it.