home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Graphics / Graphics.zip / os2apipm.zip / APIEXAM / DELFL.ADB < prev    next >
Text File  |  1995-11-04  |  915b  |  29 lines

  1. -- Simple example DosDelete  API OS/2
  2. -- delete file
  3. -- in the end of current directory on path
  4. with Ada.text_io; use Ada.text_io;
  5. with builtin; use builtin;
  6. with os2;use os2;
  7. with os2.fm;use os2.fm;
  8. with os2.err;use os2.err;
  9. procedure delfl is
  10. zero:constant character:=character'val(0);
  11. rc:apiret;
  12. l:natural;
  13. path         :string(1..60):=(others=>zero); -- buffer for path-name
  14. ppath        :PSZ :=path(1)'address;
  15. ------------------------------------------------------------------------
  16. begin
  17. put("enter file name(if will be deleted) => ");  get_line(path,l);
  18. upper_low(path); -- upper string
  19.  
  20. rc:=DosDelete(ppath);
  21. case rc is
  22. when 0 => put("File is deleted");
  23. when 2 => put("File not found ");
  24. when 32=> put("Sharing violation ");put(Err_list(32));
  25. when others => put_edit("DosDelete error=",integer(rc),4);
  26.                put(' ');  put(Err_list(integer(rc)));
  27. end case;
  28. end delfl;
  29.