I have a text file and read from it character by character. But I would like to concatenate these characters and have an array of characters.
As far as I can understand, I should use strcat. But I fail to to convert a char read from a file into a const char* so that I could use strcat:
char * strcat ( char * destination, const char * source );
In the debugger I can see that chr has "Bad Ptr". Will you be so kind as to help me?
ifstream infile;
infile.open( "Gmv.txt", ifstream::in);
char result[1000];
while (infile.good())
{
character = infile.get();
const char * chr = reinterpret_cast<const char *>(character);
strcat(result, chr);
}
infile.close();