Platform SDK: Network Management |
Windows 95/98: The following code sample demonstrates how to delete a share with a call to the NetShareDel function.
#include <stdio.h> #include <windows.h> #include <svrapi.h> int main(int argc, char FAR * argv[]) { char FAR * pszServerName = NULL; NET_API_STATUS nStatus; // // ServerName can be NULL to indicate the local computer. // if ((argc < 2) || (argc > 3)) { printf("Usage: %s [\\\\ServerName] ShareName\n", argv[0]); exit(1); } if (argc == 3) pszServerName = argv[1]; // // Call the NetShareDel function to delete the share. // nStatus = NetShareDel(pszServerName, argv[argc-1], 0); // // Display the result of the function call. // if (nStatus == NERR_Success) printf("Share deleted successfully\n"); else fprintf(stderr, "A system error has occurred: %d\n", nStatus); return 0; }