diff --git a/cpp/config-test/config b/cpp/config-test/config new file mode 100644 index 0000000..2f1e79d --- /dev/null +++ b/cpp/config-test/config @@ -0,0 +1 @@ +xe-5.2 \ No newline at end of file diff --git a/cpp/config-test/cpp43.cbp b/cpp/config-test/cpp43.cbp new file mode 100644 index 0000000..03dd1eb --- /dev/null +++ b/cpp/config-test/cpp43.cbp @@ -0,0 +1,38 @@ + + + + + + diff --git a/cpp/config-test/main.cpp b/cpp/config-test/main.cpp new file mode 100644 index 0000000..173f746 --- /dev/null +++ b/cpp/config-test/main.cpp @@ -0,0 +1,40 @@ +#include + +typedef void(*LP)();//transform a function to a pointer + +void dale() +{ + printf("cpp43 by dale clack\n"); +} + +void config() +{ +//change content in "config" file + char str[57]; + printf("Input config:"); + scanf("%s",str); + freopen("config","w",stdout); + printf("%s",str); + fclose(stdout); +} + +void test() +{ + char str[57]; + //Read content in "config" file + freopen("config","r",stdin); + scanf("%s",str); + printf("config:%s\n",str); + fclose(stdin); +} + +LP a[]={dale,config,test}; + +int main(int argc,char *argv[]) +{ + int x; + printf("Input selection:1.change config 2.test\n"); + scanf("%d",&x); + a[x](); + return 0; +}