Archive for December, 2014

How To – Get Current Time in C

December 27th, 2014 No comments

C Code to fetch current system timestamp


int main ()
time_t rawtime;
struct tm * timeinfo;

time ( &rawtime );
timeinfo = localtime ( &rawtime );
printf ( “Current local time and date: %s”, asctime (timeinfo) );

return 0;

Read more…

Categories: Programming Tags:

How To – Clear content of an entire String or Array

December 20th, 2014 No comments

If you want to zero the entire contents of the string, you can do it this way:


but this will only work for zeroing up to the first NULL character.

If the string is a static array, you can use:


Categories: ActionScript Tags:

How To – Creating a Variable Query in PostGreSQL using libpq in C

December 18th, 2014 No comments

If you don’t have libpq, you can install it using the following command in Debian

apt-get install libpq-dev

The following code shows how to create an INSERT query using strings and pass it on to the PQexec() function.






int     main() {

PGconn          *conn;

PGresult        *res;

int             rec_count;

int             row;

int             id = 1;

char           dtype = ‘W’;

char           maci[19] = {0};

char            buf[256] = {0};



Read more…

Categories: Programming Tags: