[Site Home] [Forum Home] [Articles] [File DB] [News Archives]

Programming -> C++ makes things longer


(View original topic)


Red Squirrel - Jul-21-2005 server time
Yeah I try to do that as much as possible. I'm glad I got to learning strings, since they make stuff a bit more like php, such as unlimited string lenghts, and no need to declare and reserve memory, etc.

wtd - Jul-21-2005 server time
Never use char arrays as strings in C++. If you really need a character array for some other function, use the c_str() member function.

Red Squirrel - Jul-20-2005 server time
LOL that's funny. Just make sure you're on a switch and not a hub... but if she can't figure out a real browser I doubt she can figure out a packet sniffer anyway. laugh.gif

Pyr-O-Rgasm - Jul-20-2005 server time
QUOTE (Red Squirrel @ Jul 20 2005, 07:39 PM)
QUOTE (Pyr-O-Rgasm @ Jul 20 2005, 07:19 PM)
Wow. Isn't that a zzzcensored.gif! Maybe not as big of one as my mom, but a zzzcensored.gif none-the-less.

LOL

I hope your mom does not happen to come and see your posts. tongue.gif Clear the history! em320.gif

Three people living in this house, three computers. One computer per person. If she were to touch my computer I'd be pissed. Besides, I don't have AOL on my PC and she doesn't know how to work the internet without AOL.

Red Squirrel - Jul-20-2005 server time
Wow using strings helped...


CODE

NSS_logger("Listening on port " + Int2string(listenport),0);



The int2string() function is in my custom header file and contains this:

CODE

string Int2string(int number)
{
char tmp[30];
sprintf(tmp,"%d",number);

return tmp;
}



Much, much easier. But does not beat php though. tongue.gif

Red Squirrel - Jul-20-2005 server time
QUOTE (Pyr-O-Rgasm @ Jul 20 2005, 07:19 PM)
Wow. Isn't that a zzzcensored.gif! Maybe not as big of one as my mom, but a zzzcensored.gif none-the-less.

LOL

I hope your mom does not happen to come and see your posts. tongue.gif Clear the history! em320.gif

Red Squirrel - Jul-20-2005 server time
Actually I heard that's not a good way of doing it. Not sure why though.

I just wish C++ had a nice syntax like php. tongue.gif

Strings do make things easier though, but lot of functions still use chars.

Hmm now that I think of it, I can probably use strings and dump it right in a function by going stringname.c_str(). Just thought of that now.

With strings that would cut the memset part, and make adding easier as I can just go string1 + string2.

*redesigns that part*

Cold Drink - Jul-20-2005 server time
The really funny thing is your PHP code is too long smile.gif

CODE
<?php=callfunction("Listening on port $listenport");?

or if short_open_tags is on
CODE
<?=callfunction("Listening on port $listenport");?


Pyr-O-Rgasm - Jul-20-2005 server time
Wow. Isn't that a zzzcensored.gif! Maybe not as big of one as my mom, but a zzzcensored.gif none-the-less.

Red Squirrel - Jul-20-2005 server time
I never considered this, but this is kind of funny:

CODE

 char listenmessage[45];
 char tmp[15];
 memset(listenmessage,0,70);
 memset(tmp,0,15);
 strcpy(listenmessage,"Listening on port ");
 sprintf(tmp,%d,listenport);
 strcat(listenmessage,tmp);
callfunction(listenmessage);


In php:

CODE

<?php callfunction("Listening on port ".$listenport);?>



laugh.gif

(Showing 50 last posts, newest on top)