|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
||||
|
||||
|
Reading certain line of a text file in pascal
how would i go about reading say the second line of a text file in pascal then storing it in a variable?
|
|
#2
|
|||
|
|||
|
The easiest way in Pascal that I can think of is to loop through each line till you get to the specified line. Here is an example of reading everyline from a text file:
Code:
var
f: Text;
s: String;
begin
Assign(f,'MyFile.txt');
Reset(f);
while not eof(f) do
Readln(f,s);
end.
You can simply then add some code in to determine what line number you are currently reading, and if it equals the line number you want. If it does then you can store it in a variable. Hope this helps
__________________
Did this post help? Please Click The Next To My PostNeed help? Did you try Google? Take a look over at my current work in progress http://crispycrisp.org |
|
#3
|
||||
|
||||
|
i decided to do it using records instead, it was so much easier
|
| Viewing: Dev Shed Forums > Programming Languages - More > Other Programming Languages > Reading certain line of a text file in pascal |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|