Advertisement
klasscho

Untitled

Nov 12th, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. Program Project9;
  2.  
  3. {$APPTYPE CONSOLE}
  4.  
  5. uses
  6. SysUtils;
  7. function SizeOfMatrix(MyFile: string) : integer;
  8. var
  9. numb, s: char;
  10. begin
  11. s := ' ';
  12. while not eoln (MyFile) do
  13. begin
  14. numb:= numb + s;
  15. Readln (MyFile, numb);
  16. end;
  17.  
  18. end;
  19.  
  20. function FileAccess ();
  21. var
  22. MyFile: TextFile;
  23. begin
  24. AssignFile(MyFile, 'C:\Users\KaMo.by Admin\Desktop\Myfile.txt');
  25. Reset(MyFile);
  26. CloseFile(MyFile);
  27. end;
  28.  
  29. procedure ReadFileName (var MyFile: TextFile);
  30. var
  31. FName: string;
  32. IsValidInput: boolean;
  33. begin
  34. IsValidInput := False;
  35. repeat
  36. Writeln ('Enter a file name for data entry in the format Name.txt');
  37. Readln(FName);
  38. if FileExists (FName) then
  39. begin
  40. AssignFile(MyFile, FName);
  41. Reset(MyFile);
  42. if EoF(MyFile) then
  43. Writeln('File is empty.');
  44. else
  45. IsValidInput := True;
  46. end;
  47. else
  48. Writeln('Input Error. This file is empty.');
  49. until IsValidInput;
  50. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement