Jan 31, 2011 at 6:30pm UTC
hai everyone. I'm stucked in the middle of my programming. I'm trying to read data form the file, and then create the classes as well as feature vector format for that data. e.g my data: 9.8776757 classes & feature vector format: 1 1:9.8776757. if you could tell me what should i change, i would be most grateful.
#include <stdio>
#include <iostream>
#include <stdlib>
#include <fstream>
#include <string>
#include <conio>
int main()
{
const int SIZE = 100000;
char input[SIZE];
int lineCount = 1;
int length=0;
string lineBuffer;
ifstream infile;
ofstream outfile;
outfile.open ("schizo_output.dat", ios::out | ios::app);
infile.open ("schizo.dat", ios::in);
if(!infile)
{
cout << "ERROR: Cannot open file.\n";
getch();
return 0;
}
cout << "File is successfully opened! \n";
while (!infile.eof())
{
int count = 1;
count = lineCount;
int counter=0;
int classes=+1;
lineCount ++;
lineCount <<classes;
for(int q=0;q<32;q++)
{
counter++;
}
count <<" "<<lineCount <<":";
infile.getline(input,SIZE);
cout << input << endl;
outfile.close();
}
getch();
return 0;
}
the error occur on (49,15): Illegal use of pointer
Jan 31, 2011 at 6:52pm UTC
I can't see a pointer anywhere in the code you posted.
What is this supposed to accomplish?:
1 2 3 4
for (int q=0;q<32;q++)
{
counter++;
}
You never use
counter
after the
for
loop.
Last edited on Jan 31, 2011 at 6:55pm UTC
Jan 31, 2011 at 7:51pm UTC
^Actually, istreams have a getline member function:
istream& getline (char * s, streamsize n );
.
As for the error...I'm not really sure what is causing it...
Jan 31, 2011 at 8:00pm UTC
Doh. So they do. I did not know that and the first lookup I found didn't mention it. Forget I spoke.
Last edited on Jan 31, 2011 at 8:01pm UTC