EOHax


EOHax > Programming > [C++] How to clean char variable?



[C++] How to clean char variable?
Page: 1
Author Message
Jimmyee


Joined: 12th Jul 2008
Location: Idk :P

[C++] How to clean char variable?

Does anyone know, how to clear char variable? I need to do it in My proxy, because packet lengths are fucked up.

I have to clean buffer( char recvbuff[1024] ) after I receive packet.

~EDIT 1:
NVM fixed.

void clearCharBuff(char *buf)
{
for(int x=0;x<1024;x++)
{
buf[x]='\0';
}
}

 

14th May 2009 05:44 pm
Jimmyee is Offline
Profile PM jiimmyee92@hotmail.com http://jimmy92.lua.pl/ jiimmyee92@hotmail.com
Neo


Joined: 21st Jun 2007

Re: [C++] How to clean char variable?

Lol..You don't need to write a function to "clean a char buffer."

char buff[4] = {0};//Initializes a char buffer at 0. Looks like [0][0][0][0][0].
char buff2[4];//Initializes a char buffer with random data. Looks like [rand][rand][rand][rand][rand].

If you want to set a char buffer that's already been initialized to 0, use memset.

memset(buff2, 0, 4);//Set all chars in buff2 to 0. Looks like [0][0][0][0][0].

NEO
18th May 2009 11:26 pm
Neo is Offline
Profile PM Neo-824@hotmail.com http://zneo.us.to Neo-824@hotmail.com
Westside Rep


Joined: 2nd Nov 2006
Location: Tampa, Florida

Re: [C++] How to clean char variable?

This is bullshit.

24th May 2009 01:18 pm
Westside Rep is Offline
Profile PM westside.rep@hotmail.com http://westy.us.to westside.rep@hotmail.com
Jimmyee


Joined: 12th Jul 2008
Location: Idk :P

Re: [C++] How to clean char variable?

Ok ty, I just wanted to clear buffer for packets in My proxy.

 

26th May 2009 11:42 am
Jimmyee is Offline
Profile PM jiimmyee92@hotmail.com http://jimmy92.lua.pl/ jiimmyee92@hotmail.com
Funwhendrunk


Joined: 28th Mar 2009
Location: Florida

Re: [C++] How to clean char variable?
Westside Rep posted: (24th May 2009 01:18 pm)



gtfo
16th Jun 2009 10:57 am
Funwhendrunk is Offline
Profile PM creechl84@gmail.com http://neverpool.com Funwhendrunk@live.com 10
Page 1 of 1
1




EOHax > Programming > [C++] How to clean char variable?

Advertisement