Eclipse - Errors - While coding

This section will gather all errors found when you were coding in Eclipse.
It is really hard sometimes to find what is the problem when you get an exception.

I will also give a solution of the problem.

C - Errors - Handling errors

In this tutorial we will how to easily manage errors in C programming language.

That is we will try to open a file and if this file doesn't exist we will trigger an error.
If the file exists, we will tell its name with a message to say that the file really exist.

OCaml - List - Iterating through a list and displaying all elements inside

As you already saw it, creating a list in OCaml is not so difficult.
But this time, we will see how to iterate through a list and display all elements inside.

We will create two arrays, one of ints, the other of strings.
Once done, we will display their elements.
Let's see it with this OCaml list tutorial.  

OCaml - List - Creating a list

As all programming languages, it is possible to create lists in OCaml.

So, let's see this, right now with new examples.
We will indeed create two functions, one of ints and another of strings.

For the ints:

OCaml - Function - Creating a getter to retrieve an element of a tuple

OK, this is not really a getter implementation like we can have it in other object-oriented programming, but it is close of it.

We have first to create an human variable with a tuple ("name", age).
Then we have to create two getter functions to retrieve the first and the second parameter of this human variable.

OCaml - Function - Using recursion

OCaml is a fully recursive language. So using recursion is completely natural.
We will see in this example how to create an easy recursion of a classic factorial. This in two different manners.
These two ways of using recursion are strictely the same, the type of the function and the result as well of course.

OCaml - Function - Creating an easy function

In this tutorial we will see how to create a function in OCaml language.
It will be an easy function to understand how it works.

We will create a function that returns an int + 1.
Here the code:

OCaml - Variable - Creating variables

For creating variables in OCaml we need to use the let keyword.

The syntax to create a variable is the following:


# let myVar = 90;;

When you type enter, it will be displayed the type of your variable:


OCaml - Utilities - Using the rlwrap command

When you use OCaml on Linux for example, you cannot by default using the arrow from your keyboard, neither the completion.
If you try to use them you will have something like that:

# ^[[A^[[D^[[C^[[B^[[D^[[A^[[C^[[D^[[B^[[C

But there is readline wrapper named rlwrap that will help us in this task!

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:


Subscribe to RSS