I want to implement tab completion to my program, similar to a unix shell's.

Like if the user types comp and hits <tab>, completion would appear (suppose there's a file named "completion" in the current directory).

Someone suggested using the readline library, but it seems too difficult to use that.
Is there another way?

Or is there any source available that does a similar thing using readline, so I can understand better off code examples?

I'm using Linux and GCC 3.4.6

First of all, you'll have to figure out how to read a character at a time (without the need for ENTER) which is not standard. I think GCC can do it but you'll have to figure it out yourself.

Then you'll have to grab the name of each file in the directory that matches what was typed so far.

Then you have to replace what was typed with the filename found. This generally uses a graphics library so you can move the cursor where you need it, also non-standard.

One way to implement this is to:
When TAB is pressed, find the files, output the first file name.
If another TAB is hit, change to the next file name.
If different key is pressed, redisplay what was entered and add that keystroke to the input.