0
getline (char* s, streamsize n, char delim );
I am c++ learne and what does delim do here?
7 odpowiedzi
+ 9
Can you show the code?
+ 9
Don't use it then if it works without it...
+ 8
It's the char that you specify to be extracted from the line when found...
+ 8
try using '\r' as delim if you want it to stop when enter is pressed.
0
//getline example
#include <iostream>
using namespace std;
int main () {
char name[256], address[256];
cout << "Please, enter your name: ";
cin.getline (name,256);
cout << "Please, enter your Address: ";
cin.getline (address,256,'\t');
cout << name << "'s address is " << address;
return 0;
}
0
ok, but why its not stopping getting when i click Enter , i ask to enter until size is full
0
it doesnt terminate untill all 256 characters are inserted, but without '\t' it works well, it finishes when i click enter