Read and Implement code from a dat or text file

Hey guys, I am making a program. For that now i am thinking of making a backup. Which is simple that i write all the data from code form in a .dat or .txt file.
Now I want my compiler to read code from that file and run it.
If any other file format can do it, just tell how to do it.

PS: I am not using visual c++, its just normal c++.
Thank you...
You would need to make a program that uses "ofstream" and "ifstream".

1: ofstream prints things to a file.
2: ifstream reads from a file.

Find out about both here : http://www.cplusplus.com/doc/tutorial/files/
No no. I know how to write, read and create a file.
See its like
suppose i have a file named "abc.format"
inside the file i have written
"#include<iostream.h>
void main()
{
cout<<"Hello";
getch();
}"

Now when i read the file, this code inside should be compiled.
closed account (48T7M4Gy)
Sounds like the OP is about make files and making make files (would you believe)

Maybe this reference helps as a starter:
http://www.chemie.fu-berlin.de/chemnet/use/info/make/make_1.html

Linux-type people love this stuff IIRC.
@kemort
I didn't get you.
Please help...
closed account (48T7M4Gy)
Which part didn't you get?
What is OP?
What is IIRC?
What is the answer/solution, how do i do it?
For your three questions, in order:

1) Most people believe the widely used acronym
OP
stands for "original poster." But no, those people are wrong and stupid. It obviously means "overpowered."

2) "If I remember correctly."

3) What you are referring to, and what @kemort has linked you, is makefile, which I believe is basically using a compiler's executable to run code through a file that has syntactically correct code inside it. I might be wrong on this, due to not having had much exposure to this stuff.

http://www.cs.swarthmore.edu/~newhall/unixhelp/howto_makefiles.html#C
http://stackoverflow.com/questions/2481269/how-to-make-a-simple-c-makefile
closed account (48T7M4Gy)
Thanks YFGHNG for the explanation, I've been tied up with other things.

@ay2306
Unfortunately I can't add anything to what I guessed might be relevant. I'd help if I could but I've plumbed the depths of my knowledge on what may be a red herring anyway. Good luck with your quest.
Topic archived. No new replies allowed.