Posts

Showing posts from June, 2010

Converting int to char* in C/C++

A very common issue we face is to convert an integer into a char pointer or array. This can be achieved using sprintf. int count = 600; unsigned char size[3]; sprintf(size, "%03d", count); Thats it! Here '%03' means that a minimum of 3 characters will be printed and if the number is smaller than that it will be left-padded with 0's.

Loading kernel modules

Use 'lsmod' to display all the loaded modules. If the module you are looking for is not visible, you need to load it. For this use 'insmod module_name.ko'. If this still throws errors, you might consider recompiling the .ko files.

Filtering packets in Wireshark

When you open Wireshark, there is a Option for Filter on top. However, that doesn't seem to work. Instead, go to Capture->Options. Next, in the field adjacent to 'Capture Filter', type in the filter. This could be 'host 192.168.123.233' for example. The host command filters packets to/from the give ip .