Chdir problem

Fairlight fairlite at fairlite.com
Tue Aug 31 20:41:02 PDT 2004


Yo, homey, in case you don' be listenin', GCC Consulting done said:

> Since the EDI program( not fp) which generates the 977.rpt ASCII file
> isn't printing it correctly, I want use fp to "walk" thru each directory
> and using the system command, print the report.
>
> There are at least 8 possible edi customer directories which have to be
> checked for a current 997.rpt file.

The number should be irrelevant.

You want to look at OPENDIR, NEXTDIR, CLOSEDIR, and EXISTS with the array
@FSTAT[] in v5.x.  The first three are only necessary if you need to
actually traverse directories.  If you just need to peek at that file in 8
locations, you could just use EXISTS and check @FSTAT[].

>From the documentation I just read, if you do an EXISTS on a pathname, it
fills in that array.  You get the date and time in (10,mdyy/) and (8,TIME)
formats, respectively from elements 11 and 12 if you're looking at
modification time.

As for traversing trees, you can tell what type of file something is by
looking at st_mode in other languages, but that won't work in fP because
it's tied to the st_mode, and fP apparently truncates that to -only- the
permissions part of the mode element, discarding the file type.  I'm at a
bit of a loss there.

HTH...some.  :)  Directory traversal is no problem in damned near anything
else, but I've never had to code it in fP.  I'm not seeing any handy
methodology of distinguishing between file and directory in the docs, since
they've hacked up the contents of st_dev.  :(

mark->
-- 
Bring the web-enabling power of OneGate to -your- filePro applications today!

Try the live filePro-based, OneGate-enabled demo at the following URL:
               http://www2.onnik.com/~fairlite/flfssindex.html


More information about the Filepro-list mailing list