I can't output this, no matter how hard I try
I try to output a specific character into a file, but everytime I do, it just stands "unterminated string or character constant" and "possible real start of unterminated constant".
It's not a: \, a: ' or a: " which I'm trying to output, it's another character.
I've also tried to put a: \, before the character, but it doesn't help.
Although I know that it's possible to output this character because I have another program that does it.
I haven't got a clue! :confused:
It would be an , but I'm not sure if it can "survive" through HTML
Else, it would look like this: ^Z, even though it's not the same character as the one I'm talking about.
*Still: :confused:*
Sorry, but I'm not very good at this
I've tried a number of variants of your suggestions but nothing works, so I just hand the code over to you:
#include <fstream>
int main()
{
std::cout << "Creating file..." << std::endl;
std::ofstream thefile("thefile.dat");
std::cout << "Writing to file..." << std::endl; thefile << "other text";
return 0;
}
What should I replace the with, and how can I get it's binary value? And should I also convert the other text to binary format?
Please fix this code once and for all.
Re: Sorry, but I'm not very good at this
Quote:
Originally posted by Zewu
I've tried a number of variants of your suggestions but nothing works, so I just hand the code over to you:
#include <fstream>
int main()
{
std::cout << "Creating file..." << std::endl;
std::ofstream thefile("thefile.dat");
std::cout << "Writing to file..." << std::endl; thefile << "other text";
return 0;
}
What should I replace the with, and how can I get it's binary value? And should I also convert the other text to binary format?
Please fix this code once and for all.
Have you tried opening the stream like this:
ofstream thefile("thefile.dat",ios::binary);