USB Read/Write between Arduino and Ubuntu pc

PaulS:

Now the problem is that Arduino is not able to recognize the commands sent by the C program: it always returns Error.

So you post the PC code. Why?

Because I thought the sketch is correct now since it manages the string correctly, so i posted the C code in order to receive some help on it.

May be, i'm not sending the commands in the correct way with my C code and someone can give me some suggestions.

In fact, to test it I added a println(myCmd) after the for loop in order to get back the string received and i noticed that Arduino receives just the "c" character of the whole string "check" sent my the C program.

C program sends "check"
Arduino receive "c" and then sends "Error".

Someone can help me on this problem, please?