Solved

An easy delphi question

Posted on 2003-11-26
5
191 Views
Last Modified: 2010-04-05
i need to write a program.
Source contains a number of strings, each on a seperate line. Read the
strings one at a time printing them to the screen until contained in finish is
read or the end of the file is reached. Write to the screen a message stating
which occured first. The strings are to be considered case sensitive.

i can read the data until the end of file if found, but after that im stuck.. any ideas???
0
Comment
Question by:jarhys
  • 2
5 Comments
 
LVL 2

Accepted Solution

by:
TheLeader earned 25 total points
ID: 9828630
do you mean show the result of the file
you should make an output file, or memo if you would like

assign ( ...... )   //  if you would like to create an output file
rewrite( ..... )   // to make it ready for writing result

or
memo1.text :=  ........


anyway, you said idea, if you would like the code i can write it.

is this what you meant !?
0
 
LVL 2

Expert Comment

by:TheLeader
ID: 9828642
ofcourse you can do what ever you want after the condition


if FileExist ({filename & location})
if Eof(fileinput) then
...
// do what ever you want

hope it helped
0
 
LVL 17

Assisted Solution

by:geobul
geobul earned 25 total points
ID: 9831383
Hi,

program Project1;
{$APPTYPE CONSOLE}
uses
  SysUtils;

var
  f: textfile;
  fname: string;
  EndLine: string;
  line: string;
begin
  // enter some data
  Write('Enter filename:');
  Readln(fname);
  Write('Enter stop line (case sensitive):');
  Readln(EndLine);
  // open the file
  if FileExists(fname) then begin
    Assign(f, fname);
    Reset(f);
    while not EOF(F) do begin
      Readln(f, line);
      Writeln(line);
      if line = EndLine then begin
        Writeln('Stop string has been found');
        break;
      end;
    end;
    if EOF(f) then Writeln('End of file has been reached');
    CloseFile(f);
  end else begin
    Writeln('File does not exist');
  end;
end.

Regards, Geo
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now