User forums > Using Code::Blocks
Codeblocks output window error / shut-down?
dominover:
If I go to the .exe file generated via code::blocks and run my program it runs fine and works properly too.
If I run the program via code::blocks output window I get an error and the program shuts down.
I could paste the code below, but I'm not sure if that is the issue. Checking that elsewhere. I thought I would keep this question purely code::blocks related.
Is there a setting in Code::blocks which would cause this?
As I said, the program runs find, but if I hit Run at the top of the IDE I get an error.
Thanks
BlueHazzard:
We have a significant lack of crystal balls here, so without information we can't help sorry....
greetings
dominover:
Ok. Well, hopefully some code helps. I thought there might be a setting in the codeblocks IDE which may cause this. Who's to say?
--- Code: ---#include <iostream>
#include <cstdlib>
#include <vector>
#include <fstream>
#include <sstream>
using namespace std;
int main()
{
ifstream myfile;
string mystring;
vector<int> vect;
myfile.open("test.txt",ios::out |ios::binary);
myfile >> noskipws;
getline(myfile,mystring);
stringstream ss(mystring);
int i;
while (ss >> i)
{
vect.push_back(i);
if (ss.peek() == ',')
ss.ignore();
}
for (int x = 0; x < vect.size(); x++) //Now display the vector contents.
cout << vect[x] << endl;
system("pause>nul");
}
--- End code ---
BlueHazzard:
the error would help much more...
dominover:
Actually, the error has gone now. I restarted my pc. The error was, this program 'program name' has encountered an error and needs to shut down. It's a windows error screen. (ask if you want to send the error to microsoft.
The problem is that there is no output in the output window. I have to double click on the exe file to see the output.
Is that something to do with code::block settings.
Navigation
[0] Message Index
[#] Next page
Go to full version