strcopy problems, file I/O
I'm trying to let the user dynamically enter the name for text files that they are reading into my program, as well as what they what the output to be.
I know with C++, that ifstream and ofstream are what's needed and those are working fine.
I do a cin>>input and read it into a char array(cstring). I have included string.h with my includes. Now the .open function requires a cstring as an input. Something like
As is, this works ok but you have to specify the .txt part of the file and I would like to take it a bit further.
cout<<"put the name of the file you want to open: ";
I want to automate the .txt part, as well as use the input filename as part of the 2 output filenames that I want.
Basically, I want to read in from say: Test1.txt.
For my program I want to only have the user input "Test1", and have my program add the .txt to it before it does the myfile.open part.
I have tried doing:
I put the inputfile into another container because I want to reuse inputfile for the 2 outputs like so:
Which should give me "Test1.txt" as my input, and "Test1 -translation.txt", and "Test1 -reportfile.txt" as the 3 different filenames. But it's not working right.
Remember, I have included string.h, and I have also tried it with <cstring>. I'm not really sure what else I can do, is my compiler so old(its not a very up to date linux box) that it doesn't have this function built in?
Every time I compile I get "'strcopy' was not declared in this scope"
The only reason I'm doing it with C strings is because myfile.open(filename.txt) requires it's input to be a C string, otherwise I would use the string container. I could also use the c_str() to convert a C++ string to C, but then I would still run into the same issues using strcopy.
Any help would be appreciated.