Hi,
I am a self-taught C++er. Since I taught myself, I will admin it wasn't the best education, but it got the job done for simple C++ patches to some of my favorite open-source programs.
Recently, I decided to take a crash-course in making Windows Forms with the Windows Form maker embedded in Microsoft Visual Studio .NET 2003. My goal was to make a program that allowed users to send "net send" messages to other people. Now before you say this is a stupid idea, consider this:
I have a function that gathers a list of names of computers on the local network (LAN), using the .NET API function NetServerEnum(...). Out of it I extracted the actual names of the network computers, which are sent to this function:
Now, I half-copied this function from a tutorial on NetServerEnum. The printf() line was inserted there by the original author, and that works perfectly, returning the server name -- but to the command line. My method, which is shown on the last line (return), is MY shoddy attempt at converting pSI to a std::string. However, my method only gives me the first letter of each domain name on the network. I would like it to return the entire name. The first example works great-- if it didn't' dump to stdout.
I need a way to convert pSI to a full length domain name contained in an std::string for use later. How would I do that?
If you need more of the program I can give it to you.
I am a self-taught C++er. Since I taught myself, I will admin it wasn't the best education, but it got the job done for simple C++ patches to some of my favorite open-source programs.
Recently, I decided to take a crash-course in making Windows Forms with the Windows Form maker embedded in Microsoft Visual Studio .NET 2003. My goal was to make a program that allowed users to send "net send" messages to other people. Now before you say this is a stupid idea, consider this:
- Some of the computers I want to use this on have the command prompt disabled
- net send is a great Windows-only feature, and since I'm using a Windows Form, I wouldn't be tempted to port this to another OS (I like perfection )
I have a function that gathers a list of names of computers on the local network (LAN), using the .NET API function NetServerEnum(...). Out of it I extracted the actual names of the network computers, which are sent to this function:
Code:
std::string print_si(SERVER_INFO_101 *pSI){
printf("%-16.16S", pSI->sv101_name);
//pSI->sv101_name is type LPWSTR _SERVER_INFO_101::sv101_name
return std::string(pSI->sv101_name);
}
Now, I half-copied this function from a tutorial on NetServerEnum. The printf() line was inserted there by the original author, and that works perfectly, returning the server name -- but to the command line. My method, which is shown on the last line (return), is MY shoddy attempt at converting pSI to a std::string. However, my method only gives me the first letter of each domain name on the network. I would like it to return the entire name. The first example works great-- if it didn't' dump to stdout.
I need a way to convert pSI to a full length domain name contained in an std::string for use later. How would I do that?
If you need more of the program I can give it to you.