I have a really simple code to create a text file called "Input.txt", and write to it using ostream_iterator:
using namespace std;
int main()
{
    ofstream os{ "Input.txt" }; 
    ostream_iterator<int> oo{ os,"," };
    vector<int> ints;
    for (int i = 0; i < 1000; i++)
    {
        ints.push_back(i);
    }
    unique_copy(ints.begin(), ints.end(), oo);
    system("PAUSE");
    return 0;
}
The code above creates a "Input.txt", but there is nothing written to it. Am I missing something really obvious and fundamental?
Aucun commentaire:
Enregistrer un commentaire