Serial communication between PC and Arduino using C
Your program works flawlessly on my Ubuntu 18.04. I would guess that you
have a problem with your setup (flaky USB port, permission problems...)
rather than the program itself. Still, I would recommend you add some
error checking: right after the fopen() call,

if (!usb_port) {
    perror(arduinoPort);
    return 1;
}


I would expect you see something like

/dev/ttyACM0: No such file or directory


or

/dev/ttyACM0: Permission denied


that could help you pin down the real problem.