home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / suite.zip / pct.zip / fileinfo.ext < prev    next >
Text File  |  1999-12-20  |  2KB  |  69 lines

  1. @File Info
  2. %Charin file to a variable
  3. $/* Charin file to a variable */
  4. numchars = CHARS(filename)
  5. value = CHARIN(filename,1,numchars)
  6. rc=STREAM(filename,'c','close')
  7. %Close file
  8. $/* Close file */
  9. CALL STREAM filename, 'C', 'CLOSE'
  10. %Does file exist?
  11. $/* Does file exist? */
  12. value = (STREAM(filename, 'C', 'QUERY EXISTS') <> '')
  13. %Get file date & time stamp
  14. $/* Get file date & time stamp */
  15. Parse Value STREAM(filename, 'C', 'QUERY DATETIME') With fdate ftime
  16. Parse Var fdate mm '-' dd '-' 'yy'
  17. Parse Var ftime hh ':' mm ':' ss
  18. %Get file size in bytes
  19. $/* Get file size in bytes */
  20. value = STREAM(filename, 'C', 'QUERY SIZE')
  21. %Get file status
  22. $/* Get file status */
  23. value = STREAM(filename, 'S')
  24. %Get file status with error code
  25. $/* Get file status with error code */
  26. value = STREAM(filename, 'D')
  27. %More characters in the file?
  28. $/* More characters in the file? */
  29. value = CHARS(file)
  30. %More lines in the file?
  31. $/* More lines in the file? */
  32. value = LINES(file)
  33. %Open file for reading
  34. $/* Open file for reading */
  35. /* rc will hold 'READY' if successful */
  36. rc = STREAM(filename, 'C', 'OPEN READ')
  37. %Open file for reading & writing
  38. $/* Open file for reading & writing */
  39. /* rc will hold 'READY' if successful */
  40. rc = STREAM(filename, 'C', 'OPEN')
  41. %Open file for writing
  42. $/* Open file for writing */
  43. /* rc will hold 'READY' if successful */
  44. rc = STREAM(filename, 'C', 'OPEN WRITE')
  45. %Read a character from the file
  46. $/* Read a character from the file */
  47. value = CHARIN(filename)
  48. %Read a line from the file
  49. $/* Read a line from the file */
  50. value = LINEIN(filename)
  51. %Set read/write position in file backward from current position
  52. $/* Set read/write position in file backward from current position */
  53. Call STREAM filename, 'C', 'SEEK -'value
  54. %Set read/write position in file forward from current position
  55. $/* Set read/write position in file forward from current position */
  56. Call STREAM filename, 'C', 'SEEK +'value
  57. %Set read/write position in file from end of file
  58. $/* Set read/write position in file from end of file */
  59. Call STREAM filename, 'C', 'SEEK <'value
  60. %Set read/write position in file from start of file
  61. $/* Set read/write position in file from start of file */
  62. Call STREAM filename, 'C', 'SEEK ='value
  63. %Write a line to the file
  64. $/* Write a line to the file */
  65. CALL LINEOUT filename, value
  66. %Write a string of characters to the file
  67. $/* Write a string of characters to the file */
  68. CALL CHAROUT filename, value
  69.