This is a really simple example of how to use NWSetFileAttributes() to modify attributes of a file. Please note that you cannot modify all file attributes that NetWare supports with this function, only FA_NORMAL, FA_READ_ONLY, FA_HIDDEN, FA_SYSTEM, FA_EXECUTE_ONLY, FA_NEEDS_ARCHIVED and FA_SHAREABLE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <nwcalls.h>
int main( int argc, char* argv[]) {
NWCCODE ccode;
NWCONN_HANDLE conn;
NWDIR_HANDLE dirHandle;
nstr8 newPath[ 256];
if ( argc != 2) {
puts( "Usage: SetFAttr <filename>");
return EXIT_FAILURE;
}
ccode = NWParseNetWarePath( argv[ 1], &conn, &dirHandle, newPath);
if ( ccode != 0) {
printf( "NWParseNetWarePath failed, ccode = %x\n", ccode);
return EXIT_FAILURE;
}
ccode = NWSetFileAttributes( conn, dirHandle, newPath, FA_HIDDEN | FA_SYSTEM, 0);
if ( ccode != 0) {
printf( "NWSetFileAttributes failed, ccode = %x\n", ccode);
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
© 2008 Novell, Inc. All Rights Reserved.