gets(arrangement); function on Visual Studio 2015

In school I use Visual Studio 2010 and I have no problem with the "get" function, but I downloaded VS community to practice in my home (as I understand it's VS2015 or similar) and the I can't run the same code I did in VS2010. Did you know an equivalent function or another to do the same?

1
2
3
4
5
6
  char Names[70];
       cout<<"Write your name(s)"<<endl;
       gets (Names);

       cout<<"Your name is: "<<endl;

That's a short example of what I want to do.
It's a project in Win32 console
Thanks
Did you #include <cstdio>?

PS: Why even bother with gets()? Just use std::getline().
Last edited on
closed account (E0p9LyTq)
The most recent revision of the C standard (2011) has definitively removed this (gets) function from its specification.

The function is deprecated in C++ (as of 2011 standard, which follows C99+TC3).

VS2015 uses the latest C standard, VS2010 doesn't.

You either need to get a copy of VS2010 for home use, not recommended, or as helios suggested use std::getline.

You might want to learn about the C++ string library also, since getline uses C++ strings, not C-style char array strings.
Last edited on
The string library and getline works (as you say), so Thanks
Topic archived. No new replies allowed.