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

  1. -- move file DosMove API OS/2
  2. with Ada.text_io; use Ada.text_io;
  3. with builtin; use builtin;
  4. with os2;use os2;
  5. with os2.fm;use os2.fm;
  6. with os2.err;use os2.err;
  7. procedure movfl is
  8. zero:constant character:=character'val(0);
  9. ind :integer;
  10. rc:apiret;
  11. l:natural;
  12. OldName      :string(1..60):=(others=>zero); -- from
  13. pold         :PSZ :=OldName(1)'address;
  14. NewName      :string(1..60):=(others=>zero); -- to
  15. pnew         :PSZ :=NewName(1)'address;
  16. ------------------------------------------------------------------------
  17. begin
  18. put("Enter old full file name (c:\xxxxx) => ");  get_line(OldName,l);
  19. upper_low(Oldname); -- upper string
  20. new_line;
  21. put("Enter new full file name (c:\xxxxx) => ");  get_line(NewName,l);
  22. upper_low(NewName); -- upper string
  23. new_line; put("Moving from =>");
  24. ind:=index(OldName,zero)-1; put(left(OldName,ind));
  25. put(" to =>");
  26. ind:=index(NewName,zero)-1; put(left(NewName,ind));
  27. new_line;
  28. rc:= DosMove(pold,pnew);
  29. case rc is
  30. when 0 => put("File moved");
  31. when others => put_edit("DosMove error=",integer(rc),4);
  32. put(" "); put(Err_list(integer(rc)));
  33. end case;
  34. <<fin>>  null; end movfl;
  35.