heres the code:
Code:
#include <iostream>
#include <string>
using namespace std;
int main(void)
{
char line[20];
cin.getline(line, sizeof(line));
cout << line << endl;
return 0;
}
when compiling with djgpp (gxx), cin.getline() requires i input the string twice. i dont have this problem with msvc.
is this a compiler bug or am i missing something that msvc is letting me get away with?
please dont eat me alive if this has been asked before. ive searched the board and most of the post pertained to issues concerning cin leaving a '\n' in the input buffer and getline catching it.
thanks