UNIX & GNU/Linux - System calls - Using time()

It is sometimes useful to display the current date in your terminal.
For that the time() system call function is the best one.
Let's see an example within this tiny tutorial of C programming language:

C++ - Tips'n Tricks - Converting a std:string into an int and converting an int to a std::string

For the C, we had the famous atoi() function, but for C++, how can I convert a std::string into an int?

C++ - Keyword - virtual

The virtual keyword is used in different ways in C++.

The most common way to use it is before a destructor.
Indeed, with this virtual keyword we can specified that the children of a class will be deleted before its parent.

Let's see it with a tutorial.

C++ - Makefile - Adding flags

A personal Makefile is sometimes better than a Makefile generated by default by your IDE, such Eclipse or Visual Studio C++ for example.

C++ - Errors / Warnings - After compiling

As the same for the C - Error / Warning section, I made this one to summarize common mistakes when I tried to compile my code.

So let's go to see some good errors and warnings in C++ (I'm sure it is also a great moment for you when you discovered these errors).

C - Errors / Warnings - After compiling

Errors and warnings generally encountered by a coder during his hard life of coder will be added here, in this special section.

I will not make difference between errors and warnings, because I always compile with CFLAGS such as -Wall -Werror -Wextra and thus warnings are treated as errors.

C - Recursion - Classical recursion of a factorial

A classical example of recursions is of course the factorial one.

If you want to know the result of a factorial, do not hesitate to use a recursive function.

Let's see it:

C - Recursion - Finding a number until a variable reaches another one

The code below display the nb variable until it reaches the number ten.

But the recursion will display the phrase in the printf(), of the main(), at the end of the while inside the r() function.

Android - MediaPlayer - Example of playing sounds

Maybe you are wondering how to play a MP3 sound by clicking a simple Button on Android.

Eh, you know what? You are in the right place!

Note that this tutorial for MP3 sounds works as well with MP3 musics and of course a lot of different types of format such as WAVE or MIDI.

Java - Tips'n Tricks - Source attachment

You are maybe searching for the Sourch Attachment in Java and Eclipse.

If yes, just follow this link: http://www.badprog.com/eclipse-java-source-attachment

Pages

Subscribe to BadproG.com RSS