I get a name from the user and output it to a file "name.txt". For instance, if the user entered 'tofugirl' I write to a file called "tofugirl.txt". However, how would I get "name" ("tofugirl") back since it is concatinated to the ".txt"? Is there an "un concatinate'?
Any help greatly appreciated. Code at the bottom.
Code:char *name; FILE *ofp; printf("Please enter name\n"); scanf("%s", name); strcat(name, ".txt"); ofp = fopen(name, "w"); if(ofp == NULL) { printf("Couldn't open %s\n", name); exit(-3); }