aboutsummaryrefslogtreecommitdiff
path: root/cpp00/ex01/utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp00/ex01/utils.cpp')
-rw-r--r--cpp00/ex01/utils.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/cpp00/ex01/utils.cpp b/cpp00/ex01/utils.cpp
index 27c7daa..93b916d 100644
--- a/cpp00/ex01/utils.cpp
+++ b/cpp00/ex01/utils.cpp
@@ -6,7 +6,7 @@
/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/04/13 07:31:30 by charles #+# #+# */
-/* Updated: 2020/04/13 08:43:18 by charles ### ########.fr */
+/* Updated: 2020/11/09 12:10:25 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -15,9 +15,11 @@
int getInt()
{
std::string s;
- int tmp;
+ int tmp;
- std::cin >> s;
+ std::getline(std::cin, s);
+ if (s.empty())
+ return (-1);
for (size_t i = 0; i < s.length(); i++)
if (!isdigit(s[i]))
return (-1);