Novell Home

How to use NWSetNSEntryDOSInfo()

From Developer Community

This code shows how to set file attributes (A_IMMEDIATE_COMPRESS in this sample) with NWSetNSEntryDOSInfo()

Sample Code

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#ifdef __MWERKS__
#pragma ANSI_strict off
#endif
#include <nwcalls.h>
#ifdef __MWERKS__
#pragma ANSI_strict reset
#endif

int main( int argc, char* argv[]) {
  NWCCODE         ccode;
  NWCONN_HANDLE   conn;
  NWDIR_HANDLE    dirHandle;
  nstr8           newPath[ 256];
  MODIFY_DOS_INFO dosInfo;
  if ( argc != 2) {
    puts( "Usage: SetIC2 <filename>");
    return EXIT_FAILURE;
  }
  ccode = NWParseNetWarePath( argv[ 1], &conn, &dirHandle, newPath);
  if ( ccode != 0) {
    printf( "NWParseNetWarePath failed, ccode = %x\n", ccode);
    return EXIT_FAILURE;
  }
  dosInfo.attributes = A_IMMEDIATE_COMPRESS;
  ccode = NWSetNSEntryDOSInfo( conn, dirHandle, newPath, NW_NS_LONG, FA_HIDDEN | FA_SYSTEM, DM_ATTRIBUTES, &dosInfo);
  if ( ccode != 0) {
    printf( "NWSetNSEntryDOSInfo failed, ccode = %x\n", ccode);
    return EXIT_FAILURE;
  }
  return EXIT_SUCCESS;
}

--Dmitry Mityugov

Novell® Making IT Work As One

© 2008 Novell, Inc. All Rights Reserved.