Friday 13 January 2012

Conversion from wchar_t to char * and vice versa

 Conversion from wchar_t to char * and vice versa



Converts a sequence of multibyte characters to a corresponding sequence of wide characters.
size_t mbstowcs(
   wchar_t *wcstr,
   const char *mbstr,
   size_t count 
)

Thursday 12 January 2012

Wednesday 11 January 2012

some useful CURL's command line arguments

Some useful CURL's command line arguments

Curl follow location : use "-L" option
   i.e If page redirects, curl should redirect to that page as well or to follow the location
    curl -L -b google.com

Curl add proxy 
    curl -x 172.28.1.253:8080 ftp://ftp.leachsite.com/README

Curl user agent

WAIT() function in c/c++


WAIT() function in c/c++
#include <stdio.h>
#include <time.h>

void wait ( int seconds )
{
  clock_t endwait;
  endwait = clock () + seconds * CLOCKS_PER_SEC ;
  while (clock() < endwait) {}
}

Wednesday 4 January 2012

libtidy : convert html to xml

LIBTIDY: Tidy up your html code


Out of various uses of libtidy, this post contain one simple use of libtidy.
It convert your html page code, parse it , tidy it  and finally produce an xml doc ready to be fed to your xml parser like libxml.

For that we either provide command line options to the tidy or we can write down all the command line option in a single file so that we only need to pass only one command line argument and that is you guess it right, it's config file path. :D