I need a way to make a program work on only the first computer it is run on, it doesn't need to be very secure but it needs to work. The idea that I came up with is to have the program save the MAC Address (of the first computer it is run on) inside of its own EXE. And then from then on check to see if the MAC Address corresponds to the computer its on..

So I have a couple questions

1. How can I have a program edit its own file during execution. Is this possible? Are there workaround ways to do it?

2. How can I have the compiler tell me where, in the file, a certain piece of data was saved. I'm using GCC, though I could use Visual C++.

Thanks everybody!