Serial communication PC to Arduino using C and send via NRF
Working with serial in C on Linux is not as simple as opening a file and reading from it (though in some circumstances that can work).

You should open the file using open() not fopen(), then use tcgetattr() and tcsetattr() etc to configure the port.

For example:

#include &lt;stdio.h&gt;
#include &lt;fcntl.h&gt;
#include &lt;termios.h&gt;
#include &lt;unistd.h&gt;
#include &lt;errno.h&gt;
#include &lt;string.h&gt;
#include &lt;signal.h&gt;
#include &lt;stdlib.h&gt;

struct termios oldsettings, newsettings;
int fd;

// This signal handler will close the port cleanly leaving
// it in the same state it started in
void sighandler(int sig) {
    if (sig == SIGINT) {
        if (fd &gt;= 0) {
            // Restore the settings to original
            tcsetattr(fd, TCSANOW, &amp;oldsettings);

            // Close the port
            close(fd);

            printf("Program teminated. Thank you for playing.\n");
            // Exit the program
            exit(0);
        }
    }
}

int main(int argc, char *argv) {

    // Trap CTRL-C to close the port properly
    signal(SIGINT, &amp;sighandler);

    fd = open("/dev/ttyACM0", O_RDWR);
    if (fd &lt; 0) {
        fprintf(stderr, "Error opening serial port: %s\n", strerror(errno));
        return 10;
    }

    // Save the settings
    tcgetattr(fd, &amp;oldsettings);
    // Grab the current settings again to modify
    tcgetattr(fd, &amp;newsettings);

    // Set the baud rate
    cfsetispeed(&amp;newsettings, B9600);
    cfsetospeed(&amp;newsettings, B9600);

    // Make it a raw port
    cfmakeraw(&amp;newsettings);

    // Apply the settings
    tcsetattr(fd, TCSANOW, &amp;newsettings);

    char c;
    printf("Press CTRL-C to terminate\n");

    while (read(fd, &amp;c, 1) == 1) {
        printf("Got character 0x%02x\n", c);
    }

    fprintf(stderr, "Reception terminated: %s\n", strerror(errno));

    return 0;
}


No one ever said programming C was easy. It makes you appreciate just how much work the Arduino API does behind the scenes for you...

Also you need to be aware that the Arduino resets (if you use an Uno, Mega, or other board with a separate USB interface chip) when you open the serial port. You need to wait about 2 seconds after opening the port before you ever send anything, or whatever you send will be completely ignored.  You can do that with:

sleep(2);


after you have opened and configured the port.