0

getline (char* s, streamsize n, char delim );

I am c++ learne and what does delim do here?

10th Apr 2017, 11:54 AM
alisherrakhimov
7 ответов
+ 9
Can you show the code?
10th Apr 2017, 12:45 PM
Karl T.
Karl T. - avatar
+ 9
Don't use it then if it works without it...
10th Apr 2017, 12:54 PM
Karl T.
Karl T. - avatar
+ 8
It's the char that you specify to be extracted from the line when found...
10th Apr 2017, 12:40 PM
Karl T.
Karl T. - avatar
+ 8
try using '\r' as delim if you want it to stop when enter is pressed.
10th Apr 2017, 12:50 PM
Karl T.
Karl T. - avatar
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; }
10th Apr 2017, 12:46 PM
alisherrakhimov
0
ok, but why its not stopping getting when i click Enter , i ask to enter until size is full
10th Apr 2017, 12:46 PM
alisherrakhimov
0
it doesnt terminate untill all 256 characters are inserted, but without '\t' it works well, it finishes when i click enter
10th Apr 2017, 12:48 PM
alisherrakhimov