Click here to Skip to main content
15,912,977 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralI can't enumerate my network.Help me, please!!!!!!!! Pin
utnqbao15-Sep-04 16:44
professionalutnqbao15-Sep-04 16:44 
GeneralNew to Visual C++ - Simple Program Help Pin
neoborn15-Sep-04 15:49
neoborn15-Sep-04 15:49 
GeneralRe: New to Visual C++ - Simple Program Help Pin
Christian Graus15-Sep-04 16:24
protectorChristian Graus15-Sep-04 16:24 
GeneralRe: New to Visual C++ - Simple Program Help Pin
neoborn15-Sep-04 18:05
neoborn15-Sep-04 18:05 
GeneralCould really use some suggestions Pin
Tom Wright15-Sep-04 11:49
Tom Wright15-Sep-04 11:49 
GeneralRe: Could really use some suggestions Pin
Christian Graus15-Sep-04 11:59
protectorChristian Graus15-Sep-04 11:59 
GeneralRe: Could really use some suggestions Pin
Tom Wright15-Sep-04 12:20
Tom Wright15-Sep-04 12:20 
GeneralRe: Could really use some suggestions Pin
Christian Graus15-Sep-04 12:50
protectorChristian Graus15-Sep-04 12:50 
Tom Wright wrote:
So this structure thing is new to me.

A structure is just a class, under the hood the only difference is that members of a struct are public by default, members of a class, private by default.

Tom Wright wrote:
When you say to put a std::string in the struct.....what do you mean by that?

The problem with allocating a pointer is that you need to clean the memory afterwards. A std::string is probably overkill, a struct (being a class) can have a destructor, which can clean the memory for you. Something like this:

struct MyStruct
{
   char * theString;

   MyStruct()
   { 
       theString = NULL;
   }

   ~MyStruct()  
   {
     if (theString) // i.e. if theString != NULL
         delete [] theString;
   }

}


I'm a long way from the last time I used C++, so there may be some syntax problems there.

A std::string is a class offered by the standard C++ library, which allows you to manipulate strings. Overkill in this case, especially if you're building a lot of them. To use it, you would put #include<string> at the top of your .cpp file, and then using std::string; somewhere underneath.


Tom Wright wrote:
will me doing a memcopy easily convert the data stream to the appropriate typedef? From a BYTE to an int or a char?

A byte is a char. So yes, so long as your string is NULL terminated ( ends with a 0 ), you can just call new on the char * to allocate memory, then do a memcpy across to it. If it's not null terminated, just add one to the size of the array you create, call memset on it to null it all, then copy the string in.


Christian

I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
GeneralRe: Could really use some suggestions Pin
Henry miller16-Sep-04 3:34
Henry miller16-Sep-04 3:34 
Generalchange a dialog's font at runtime Pin
BlackDice15-Sep-04 11:47
BlackDice15-Sep-04 11:47 
GeneralRe: change a dialog's font at runtime Pin
Ryan Binns15-Sep-04 18:27
Ryan Binns15-Sep-04 18:27 
GeneralRe: change a dialog's font at runtime Pin
BlackDice16-Sep-04 4:20
BlackDice16-Sep-04 4:20 
GeneralRe: change a dialog's font at runtime Pin
Ryan Binns16-Sep-04 13:59
Ryan Binns16-Sep-04 13:59 
Generaladd help (?) button to title bar of child MDI window Pin
elephantstar15-Sep-04 11:28
elephantstar15-Sep-04 11:28 
GeneralTemplate issue Pin
Bob Stanneveld15-Sep-04 10:32
Bob Stanneveld15-Sep-04 10:32 
GeneralRe: Template issue Pin
Michael Dunn15-Sep-04 10:48
sitebuilderMichael Dunn15-Sep-04 10:48 
GeneralRe: Template issue Pin
Bob Stanneveld15-Sep-04 11:10
Bob Stanneveld15-Sep-04 11:10 
GeneralProtect application from hooking Pin
Fabio Panzavolta15-Sep-04 10:01
Fabio Panzavolta15-Sep-04 10:01 
GeneralRe: Protect application from hooking Pin
User 58385215-Sep-04 15:55
User 58385215-Sep-04 15:55 
GeneralRe: Protect application from hooking Pin
Fabio Panzavolta15-Sep-04 22:47
Fabio Panzavolta15-Sep-04 22:47 
GeneralCost of type Casting Pin
Nacho Chip15-Sep-04 9:59
Nacho Chip15-Sep-04 9:59 
GeneralRe: Cost of type Casting Pin
Andrew Walker15-Sep-04 13:02
Andrew Walker15-Sep-04 13:02 
GeneralSearching Image inside the Bitmap Pin
Azghar Hussain15-Sep-04 9:17
professionalAzghar Hussain15-Sep-04 9:17 
GeneralRe: Searching Image inside the Bitmap Pin
David Crow15-Sep-04 9:35
David Crow15-Sep-04 9:35 
GeneralRe: Searching Image inside the Bitmap Pin
Alexander M.,16-Sep-04 9:56
Alexander M.,16-Sep-04 9:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.