So heres my procedure:

procedure inf_output;
	Begin
	Repeat
		Begin
		Writeln('Please choose by what info you will search!');
		Writeln('1. Name');
		Writeln('2. Registration number');
		Writeln('3. Adress: Street name');
		Writeln('4. Adress: Street number');
		Writeln('5. Adress: Postal index');
		Writeln('6. Name of City');
		Writeln('7. Telephone number');
		readln(x);
		end;
	Until (x>0) and (x<7);
	Case x of 
		1:filename:=(nos);
		2:filename:=(regnr);
		3:filename:=(adr_iela);
		4:filename:=(adr_nr);
		5:filename:=(adr_ind);
		6:filename:=(adr_pils)
		7:filename:=(tel);
	end;
	Writeln('Input sarch string!')
	search:=('s'filename);
	readln(search);
	{need a part that would check if the sring isnt too long or has been input at all, Im thinking of using repeat, but i dunno how to check the lenght of string}
	Reset(filename);
	while not EoF do
		Begin
		{the search will be no case sensitive (using UpCase)}
		FileLine := UpCase(Readln(SearchFile));
		y:= Pos(UpCase(Search), FileLine);
		If (y>0) then
			Begin
			{Writeln results}
			end;
		y:=(y+Length(Search)).
		FileLine := Copy(FileLine, y, Length(FileLine));
		y:= Pos(UpCase(Search), FileLine);
		end;
	end;

The searching part I found in this forum, but I don't quite understand it completely.
It is supposed to pick a file from where to search the info, then output all relaited info to the search string.
And here are my questions

1. Notice the

Writeln('Input sarch string!')
	search:=('s'filename);
	readln(search);

part
Can I even do that? Idea is that if I add the s part to file name I got string that is limited to maximum number of characters in string, so I will not be able to input more characters than possible.

2. FileLine string is only read from file once. Isn't the length of string only 255 chars? In that case I can't input all of the file into that string. Actually it would be a lot more better if I could search in file line-by-line

3. And that brings up my main question - How can I use the line of a file instead of position? In the part that is called "{Writeln results}" I need to write a part that would print on screen all the information related to found result from all the other files. And printing the line in where the string has been found is the easiest way (I think, feel free teach me better, I'm quite new to this), because in (example) line 3 or 5 in every of these files will be relaited to only one user, because of the way it's being input.

4.Almost forgot about the

{need a part that would check if the sring isnt too long or has been input at all, Im thinking of using repeat, but i dunno how to check the lenght of string}

part

Any tips there. Getting the length isn't the problem, getting the length of search:=('s'filename); however is.

5.Any other tips you can give me? ^^

Also, if I define ,for example, MyString: String[110] if I were to input it to a file, would it add 110 spaces to file or only the ones filled in string?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.