I have made a program that searches a folder for .txt files that only have one character as a name, like "a.txt" or "K.txt". Sounds stupid I know but it is just a test, if i get it to work then i will make it more useful. Anyway, my problem is that if I for instance have the file "a.txt" in the folder then the programs says that I have "a.txt AND "A.txt" wich is very oddTake a look.
Code:program muuuu; uses crt; var i : integer; yesno : boolean; janej : char; procedure search; const format = '.txt'; var a,b,c : array [0..255] of char; filnamn : string; antal, x : integer; function exists(filnamn:string):boolean; var fil : text; begin exists := false; assign(fil,filnamn); {$I-}reset(fil);{$I+} if IOResult = 0 then begin close(fil); writeln(filnamn); exists := true; end; end; begin antal := 0; for x := 1 to 255 do begin a[x] := chr(x); filnamn := a[x]+format; if exists(filnamn) then inc(antal); end; writeln('There are ',antal,' files in this folder.'); end; begin clrscr; writeln('Do you want to scan folder?'); readln(janej); if janej in ['Y','y'] then begin clrscr; writeln('The files are as follows:'); search; end else halt; readln(); end.