thieumao

Đọc File

Apr 6th, 2013
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.52 KB | None | 0 0
  1. program docfile;
  2. uses crt;
  3. var
  4.   f:text;
  5.   path,s:string;
  6.   i,j:word;
  7.   a:array[1..100] of string;
  8.   ch: char;
  9. label Nhap;
  10. begin
  11.   i:=0;
  12.   Nhap:
  13.   clrscr;
  14.   write(' Nhap path file: ');
  15.   readln(path);
  16.   {$I-}
  17.   assign(f,path);
  18.   reset(f);
  19.   {$I+}
  20.   if IOResult <> 0 then
  21.     begin
  22.       writeln('Duong dan bi nhap sai.');
  23.       write('Chon c de tiep tuc ');
  24.       readln(ch);
  25.       if (ch='c') then goto Nhap
  26.       else exit;
  27.     end;
  28.   writeln('Noi dung file:');
  29.   read(f,s);
  30.   writeln(s);
  31.   readln;
  32. end.
Advertisement
Add Comment
Please, Sign In to add comment