Skip to content

Instantly share code, notes, and snippets.

@chengluyu
Created August 12, 2013 07:14
Show Gist options
  • Save chengluyu/6208769 to your computer and use it in GitHub Desktop.
Save chengluyu/6208769 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <cstdio>
using namespace std;
#define CONCAT(a, b) a##b
#define file_type CONCAT(FI, LE)
#define file_open CONCAT(fo, pen)
#define file_scanf CONCAT(fs, canf)
#define file_printf CONCAT(fp, rintf)
#define file_close CONCAT(fc, lose)
int main(int argc, const char *argv[]) {
file_type * f = file_open("use_macro_to_create_file", "r");
char str[100] = {0};
file_scanf(f, "%s", str);
file_close(f);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment