number of characters in stdin buffer entered by user
| satro (1) |
|
Console app. User entered some characters and clicked ENTER.
How to know the number of characters in stdin buffer that user entered from keyboard?
I just want to allocate storage space for the array of input characters.
|
|
Last edited on
|
| Adijunn (39) |
|
|
Ya, you have to use a dynamic array. Look up how to do it because I'm not completely sure about the syntax.
|
|
|
| cire (2347) |
|
Just use std::string.
1 2 3 4 5 6 7 8 9 10 11
|
#include <iostream>
#include <string>
int main()
{
std::string input ;
std::cout << "Give me some input: " ;
std::getline(std::cin, input) ;
std::cout << "You entered \"" << input << "\"\n" ;
}
|
|
|
|
Topic archived. No new replies allowed.