Definition | #include <stdlib.h> int bs2fstat(const char *pattern, void (*fct)(const char *f_name, int len));
For each file found, If no file matches the selection criterion pattern or if pattern is errored the function fct is not called and | |
Parameters | const char *pattern: String specifying the selection criterion for one or more files. For compatibility reasons, further parameters can also be specified to determine which files are selected, e.g.:
These parameters must be specified in the syntax of the ISP command FSTAT. void (*fct)(const char *f_name, int len) A user-supplied function with the parameters f_name (file name) and len (name length). | |
Returnwert | 0 | if the call was successful. |
DMS error message code | ||
if the call was not successful. | ||
Note | The DMS error message code can be only queried from outside the user-own function fct, since the function is not called if the search was unsuccessful (see also example). | |
Example | In the following program, all files matching the name pattern entered by the user are made shareable with the MODIFY-FILE-ATTRIBUTES command. #include <stdio.h> #include <string.h> #include <stdlib.h> void share(const char *, int); int main(void) { char name[54]; int result; printf("Which files are to be made shareable?\n"); gets(name); result = bs2fstat(name, share); if(result != 0) printf("Error code: DMS%x\n", result); return 0; } void share(const char *nam, int len) /* The formal parameters nam and len are */ /* supplied as current parameters by bs2fstat */ { char cmd[200]; strcpy(cmd, "/MODIFY-FILE-ATTRIBUTES "); strcat(cmd, nam); strcat(cmd, ",PROTECTION=PAR(USER-ACCESS=ALL-USERS)"); system("/MODIFY-TERMINAL-OPTIONS OVERFLOW-CONTROL=NO-CONTROL"); printf("%s\n", cmd); system(cmd); } | |
See also | system |