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

  1. --  search   file path DosSearchPath 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.misc;use os2.misc;
  6. with os2.err;use os2.err;
  7. procedure seefl is
  8. zero:constant character:=character'val(0);
  9. rc:apiret;
  10. l:natural;
  11. FileName     :string(1..60):=(others=>zero);
  12. pname        :PSZ :=FileName(1)'address;
  13. Path         :string(1..60):=(others=>zero);
  14. ppath        :PSZ :=Path(1)'address;
  15. rezult       :string(1..256);
  16. buffer       :array(1..256) of aliased byte;     -- buffer to rezult
  17. for buffer'address use rezult'address;
  18. pbuffer      :pbyte:=buffer(1)'access;
  19. len          :ulong:=256;                        -- buffer length
  20. control      :ulong:=0 ;                         -- search curent dir
  21. flag_end     :boolean:=false;
  22. ------------------------------------------------------------------------
  23. begin
  24. put("Enter file name xxx.xxx => ");  get_line(FileName,l);
  25. -- upper_low(FileName); -- upper string
  26. put("Enter full path \xxx[\xxx]... => ");  get_line(Path,l);
  27. upper_low(Path); -- upper string
  28. new_line;
  29.  
  30. rc:=DosSearchPath(flag          => control,
  31.                   pszPathOrName => ppath,
  32.                   pszFilename   => pname,
  33.                   pBuf          => pbuffer,
  34.                   cbBuf         => len     );
  35.  
  36. if rc>0 then put_edit("DosSearchPath=error",integer(rc),4);
  37.              put(' '); put(Err_list(integer(rc))); goto fin;
  38. end if;
  39.  
  40. new_line; put("List of files"); new_line;
  41. for i in 1..integer(len) loop  exit when rezult(i)=zero and flag_end;
  42.  if rezult(i)=zero then new_line;  flag_end:=true;
  43.                    else
  44.   put(rezult(i)); flag_end:=false;
  45.  end if;
  46. end loop;
  47. <<fin>> null;
  48. end seefl;
  49.