my program compiles fine, but when i use cin.getline(); to get some data, i believe it reads the return from a previous cin so it blows through the code during runtime before i can even enter any information, i've put more cin's after the cin.getline, and they don't get skipped over, just the cin.getline();...here's the code, it's fairly short, can anyone help me with this bug?
thanksCode:#include <iostream> #include <fstream> #include <stdio> using namespace std; char id[500000]; char fileHandle[]=".txt"; char* fileName; char input[100000]; int main() { cout<<"PORTFOLIO EDITOR-FILE CREATION TEST"<<endl; cout<<"Basically you type in the id number, it gets used in the creation of a file called that number plus .txt"<<endl; cout<<"ENTER ID NUMBER"<<endl; cin>>id; cout<<"Now give me something to write into the file"<<endl; cin.getline(input,99990,'\n'); fileName=strcat(id,fileHandle); ofstream fout(fileName); fout<<input; fout.close(); return 0; }



LinkBack URL
About LinkBacks


