[beagleboard] serial port programming in c++

You should check the permissions on /dev/ttyACM0.

On normal desktop ubuntu, you need to belong to the dialout group, be root,
or setup some udev rules to give world write permissions to you
/dev/ttyACM0 node.

I expect it will be similar on the BBB.

I also don't recommend using fopen with the serial port. You should
probably use regular open/close. I have some sample code here:
https://github.com/dhylands/projects/tree/master/host/sertest (uses
multiple threads)
https://github.com/dhylands/projects/tree/master/host/sertest-select (uses
a single thread)

It's also very worthwhile to read-thru and understand the Serial
Programming HOWTO that somebody else linked to.