I'm trying to read and write some files, but i get "ERROR C1001, internal error happened in compiler" every time i try to std::cout
something to my output.out
file.
Why ?
(i used _CRT_SECURE_NO_WARNINGS
in preprocesssor definition to be able to use freopen()
)
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <deque>
#include <array>
#include <vector>
freopen("C:\\somepath\\input.in", "r", stdin);
freopen("C:\\somepath\\output.out", "w", stdout);
int t;
std::cin >> t;
std::cout << t << std::endl;
for (int i = 0; i < t; i++)
{
int n;
std::cin >> n;
std::cout << t << std::endl;
std::vector <int> x, h;
x.resize(n);
h.resize(n);
for(int j=0;j<n;j++)
{
std::cin >> x[j] >> h[j];
std::cout<< x[j] << h[j] << std::endl;
}
}
EDIT : as Nighteen said, i had some errors in my code (n++, no vector resizing, now corrected)
But the bug, still there in some way :
The code is compiling in this state, but as soon as i try put cout a string, the same probleme appears
like adding <<" "
in my std::cout<< x[j] << h[j] << std::endl;
in the std::cout<< x[j] <<" "<< h[j] << std::endl;