| 1 |
#include<iostream> |
| 2 |
#include<fstream> |
| 3 |
#include<string> |
| 4 |
|
| 5 |
using namespace std; |
| 6 |
|
| 7 |
const char prefix[] = "int "; |
| 8 |
const char suffix[] = " () {\n return 52;}\n"; |
| 9 |
|
| 10 |
int main(int argc, char **argv) { |
| 11 |
if(argc != 3) { |
| 12 |
cout << "You is fail.\n"; |
| 13 |
return 1; |
| 14 |
} |
| 15 |
ifstream is(argv[1], ifstream::binary); |
| 16 |
if(!is) { |
| 17 |
cout << "Opening input file failed.\n"; |
| 18 |
return 1; |
| 19 |
} |
| 20 |
string funcname; |
| 21 |
is >> funcname; |
| 22 |
ofstream os(argv[2], ofstream::binary); |
| 23 |
if(!os) { |
| 24 |
cout << "Opening output file failed.\n"; |
| 25 |
return 1; |
| 26 |
} |
| 27 |
os << prefix << funcname << suffix; |
| 28 |
os.close(); |
| 29 |
if(!os.good()) { |
| 30 |
cout << "Writing data out failed.\n"; |
| 31 |
return 1; |
| 32 |
} |
| 33 |
return 0; |
| 34 |
} |