I am running an Ubuntu v10.04 through VirtualBox. To test the persistence of files I create in the virtual machine, I wrote a very basic C program. When I shutdown the virtual machine and restart it, I see that the files have been retained.
I can check the directory with
ls /root/and see both
program_name.cand the compiled
I use this command to compile:
gcc program_name.c -o program_name
I can run
./a.outand the program will execute properly.
Opening the C code with
nano program_name.cshows the program, as I expect it to be.
The problem is...
When I try to the program via
./program_name, nothing happens!
If I check the exit status (
echo $?), it is zero.
I am having difficulties understanding why I can't run the compiled C program, even though I can find it. It is most bizarre to me considering I can locate all the files AND
./a.outexecutes it properly.
Edited for clearer presentation.
Edit regarding answer...
In the off chance that someone else comes to this looking for help, it should be noted that while the
file program_name command did expose that the file was blank, the cause hasn't been determined. I successfully ran the executable before I restarted the virtual machine.
Perhaps I didn't shut down the virtual machine properly? Anyways, checking the file was/is certainly helpful!