GIDForums  

Go Back   GIDForums > Computer Programming Forums > CPP / C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 04-Apr-2008, 11:05
MattP MattP is offline
New Member
 
Join Date: Apr 2008
Posts: 1
MattP is on a distinguished road
Question

C++ Help


I was provided some code that I need to compile. However, this code is just a snippet. I am not well versed in C++ and humbly ask for someones assistance. I need to compile the code into an exe. Below is the code:

CPP / C++ / C Code:
#define UNICODE 1
 
#include <stdio.h>
#include <windows.h>
#include <lm.h>
#include <lmdfs.h>
 
VOID usage(PWCHAR prog)
{
fprintf( stderr, "usage: %S <DfsEntryPath> <ServerName> <SharePathName> [<on|off>]\n", prog );
}
 
__cdecl wmain(ULONG argc, PWCHAR *argv)
{
DFS_INFO_101 DfsInfo101;
ULONG Status;
LPWSTR DfsEntryPath, ServerName = NULL, SharePathName = NULL;
LPWSTR ResultString;
 
if (argc != 5) {
usage(argv[0]);
return 1;
}
 
DfsEntryPath = argv[1];
ServerName = argv[2];
SharePathName = argv[3];
 
if (!wcscmp( argv[4], L"on" )) {
DfsInfo101.State = DFS_STORAGE_STATE_ONLINE;
ResultString = L"enabled";
} else if (!wcscmp( argv[4], L"off" )) {
DfsInfo101.State = DFS_STORAGE_STATE_OFFLINE;
ResultString = L"disabled";
} else {
usage(argv[0]);
return 1;
}
 
//
// ... and modify it.
//
 
Status = NetDfsSetInfo( DfsEntryPath,
ServerName,
SharePathName,
101,
(LPBYTE) &DfsInfo101 );
 
if (Status == NERR_Success) {
printf( "\\\\%S\\%S -> %S\n", ServerName, SharePathName, ResultString );
} else {
fprintf( stderr, "error: %d\n", Status );
}
 
return 0;
}




Thanks alot for any help.
Last edited by admin II : 05-Apr-2008 at 04:06. Reason: Please surround your C code with [cpp] your code [/cpp]
  #2  
Old 07-Apr-2008, 05:59
dabigmooish's Avatar
dabigmooish dabigmooish is offline
Member
 
Join Date: May 2004
Location: Baltimore (middle of Canton)
Posts: 165
dabigmooish will become famous soon enough

Re: C++ Help


That looks like its c, not c++. What errors are you getting? We can't help you get it to compile if a) we don't have the full code, and b) we don't know what errors you're getting when you try to compile it.
__________________
"To argue with a person who has renounced the use of reason is like administering medicine to the dead."
-Thomas Paine
www.sullivan-county.com/deism.htm
 
 

Recent GIDBlogFirst week of IA training by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 15:33.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.