|
Gurrieri Fabrizio wrote:
>How can I retrieve the attributes of a file in the
>IFS by an RPGLE program???
Buongiorno! (buona notte?!)
stat() is how I do it.
h bnddir('QC2LE')
* File stats
* #include <sys/stat.h>
*
* int stat(const char *path, struct stat *buf);
*
Dstat pr 10i 0 extproc('stat')
D * value
D * value
* The OVERLAY is needed to align for the halfword st_nlink
Dinfo DS inz
D st_mode 10U 0
D st_ino 10U 0
D st_nlink 5U 0
D st_uid 10U 0 OVERLAY(info:13)
D st_gid 10U 0
D st_size 10U 0
D st_atime 10U 0
D st_mtime 10U 0
D st_ctime 10U 0
D st_dev 10U 0
D st_blksize 10U 0
D st_allocsize 10U 0
D st_objtype 10A
D st_codepage 5U 0
D st_reserved1 61A
D st_ino_gen_id 10U 0
C eval rc=stat(full_fn:%addr(info))
full_fn is the null terminated path to the file. I may have left something
out of this snippet, but it should help. I think the archives have better
examples than this...
Buck Calabro
Aptis; Albany, NY
"Nothing is so firmly believed as
that which we least know" -- Michel Montaigne
Visit the Midrange archives at http://www.midrange.com
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.