Subscribe for email updates

Get all updates to your inbox to stay tune.

Curve tracing programs - Draw sin(x) curve using Graphics programming in C

Learn how to draw curve tracing graphics programs in c language

Graphics programming in C

Learn how to write basic and advanced graphics programming in c language

Curve tracing programs - Draw Cos(x) curve using Graphics programming in C

Learn how to draw curve tracing graphics programs in c language

Make file tutorial

A step by step guide to learn how to write make file in Linux with examples

Friday, March 18, 2011

C Developer tip - Printing source info in C Programme

Lets start soemthing intresting which is commonly useful for C developers.
if you want to print filename, function name and line number  in a c programme, you can make use of following macros.
/tmp# cat x.c
    printf("file='%s' \n function='%s' line='%d' \n",__FILE__,__func__,__LINE__);
/tmp# ./a.out
 function='main' line='3'
This is very useful while programme is in panic and  you want to exit gracefully.
For example: malloc not succeeded.

Testing Posting message from mail

Hello, This is test msg which I am posting directly from email.

Thursday, March 17, 2011

Some info about SIM CARD

do you know what is SIM stands for

SIM stands for Subscriber Identity MOdule.
What is the name for the card which we insert into Mobile.
That is called
UICC- Universal Intergated circuit card.

Monday, March 14, 2011

Valgrind usage

Valgrind is a such a great tool to identify memory leaks, invalid frees, usage.. etc.
I would like give brief intro

Install valgrind on Ubuntu
apt-get install valgrind

Example Programme:
int *x;

Valgrind report:
root@ubuntu:/home/manu/valgrindtest# valgrind --tool=memcheck --leak-check=full --show-reachable=yes ./a.out
==4060== Memcheck, a memory error detector
==4060== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==4060== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for copyright info
==4060== Command: ./a.out
==4060== Invalid free() / delete / delete[]
==4060== at 0x4C270BD: free (vg_replace_malloc.c:366)
==4060== by 0x40059F: main (in /home/manu/valgrindtest/a.out)
==4060== Address 0x51b0090 is 0 bytes inside a block of size 10 free'd
==4060== at 0x4C270BD: free (vg_replace_malloc.c:366)
==4060== by 0x400593: main (in /home/manu/valgrindtest/a.out)
==4060== HEAP SUMMARY:
==4060== in use at exit: 10 bytes in 1 blocks
==4060== total heap usage: 2 allocs, 2 frees, 20 bytes allocated
==4060== 10 bytes in 1 blocks are definitely lost in loss record 1 of 1
==4060== at 0x4C274A8: malloc (vg_replace_malloc.c:236)
==4060== by 0x400575: main (in /home/manu/valgrindtest/a.out)
==4060== LEAK SUMMARY:
==4060== definitely lost: 10 bytes in 1 blocks
==4060== indirectly lost: 0 bytes in 0 blocks
==4060== possibly lost: 0 bytes in 0 blocks
==4060== still reachable: 0 bytes in 0 blocks
==4060== suppressed: 0 bytes in 0 blocks
==4060== For counts of detected and suppressed errors, rerun with: -v
==4060== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 4 from 4)

Invalid frees

There is more than this. wait and see.