Output to file produces crap
This is driving me crazy, I have the following program:
Code:
#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;
int main()
{
ofstream myfile;
myfile.open("text.txt");
for(int i = 1; i < 9; i++)
for(int j = 1; j < 9; j++)
{
myfile << "x" << i << j << " + ";
}
myfile.close();
}
Which should just create a file text.txt and put there the string:
x11 + x12 + .... + x88
What is actually outputs is:
Code:
ㅸ‱ㅸ′ㅸ″ㅸ‴ㅸ‵ㅸ‶ㅸ‷ㅸ‸㉸‱㉸′㉸″㉸‴㉸‵㉸‶㉸‷㉸‸㍸‱㍸′㍸″㍸‴㍸‵㍸‶㍸‷㍸‸㑸‱㑸′㑸″㑸‴㑸‵㑸‶㑸‷㑸‸㕸‱㕸′㕸″㕸‴㕸‵㕸‶㕸‷㕸‸㙸‱㙸′㙸″㙸‴㙸‵㙸‶㙸‷㙸‸㝸‱㝸′㝸″㝸‴㝸‵㝸‶㝸‷㝸‸㡸‱㡸′㡸″㡸‴㡸‵㡸‶㡸‷㡸‸
If I remove " + " it outputs the actual string without pluses, otherwise it outputs crap. Why?