Generally it is not possible to get back a file (but details are painfully operating system and file system specific; if on Ext4 file system on your Linux laptop you might try debugfs
from e2fsprogs). You obviously have backups, so use them (if you don't, you have painfully learned something important, and most of us did the same mistake at some early point in our life, so don't be too much ashamed).
It is time for you to understand what version control systems are. So read about git and learn to use it.
If your software is with a free software license, you could even use http://github.com/ (or something else like http://gitlab.com/) as a repository.
You might run file file.c
and ls -l file.c
and stat file.c
to get an idea of what is inside file.c
. You might list the recently modified files with ls -alst
BTW, you should compile your program with
gcc -Wall -Wextra -g file.c -o prog
This asks for all warnings with -Wall
, even more of them with -Wextra
, debugging info with -g
. Then you can use the gdb
debugger on your program as gdb prog
BTW, you might want to have a Makefile
for GNU make and to just type make
to compile your program. Here is a simple example of Makefile
.
Notice that recent GCC are able to handle pre-compiled headers (but it is not a feature very useful for a small school project). If you typed gcc -o file.c file.h
it is likely that your header file file.h
has been precompiled into file.c