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.What happens:I can check the directory with ls /root/ and see both program_name.c and the compiled program_nameI use this command to compile: gcc program_name.c -o program_nameI can run ./a.out and the program will execute properly.Opening the C code with nano program_name.c shows 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.So what gives...?I am a beginner, clearly, and 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.out executes it properly.EDIT: 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!
Having trouble executing a compiled C program
linux;ubuntu;files;c
Since you're using the -o option to rename the compiled program, the a.out you have there now belongs to something else (earlier version or something completely unrelated). Your program probably is running but just isn't returning any output. Check the file size and run file program_name to convince yourself that it's an executable then see what the code should do -- take an argument perhaps.