Click here to Skip to main content
15,888,271 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All, I'm having problems building a legacy C++ program in VS 2015, it builds without errors in Release but not in Debug, the line it baulks at it this


C++
gets_s( ch );

gets_s too few arguments for call


Why does it build in Release is my question

What I have tried:

Hi All, I'm having problems building a legacy C++ program in VS 2015, it builds without errors in Release but not in Debug, the line it baulks at it this


<pre lang="c++">
gets_s( ch );

gets_s too few arguments for call


Why does it build in Release is my question
Posted
Updated 7-Feb-18 5:41am

1 solution

This is probably sourced by the template overload of the gets_s() function which might behave differently with debug builds.

I tried this with VS 2017 and it compiles fine in debug mode:
char ch[10];
gets_s(ch);
So it might be of interest how your ch variable is declared.

To avoid the error you can pass the size explicitly:
char ch[10];
gets_s(ch, sizeof(ch));
 
Share this answer
 
Comments
pkfox 7-Feb-18 17:19pm    
Thanks Jochen I'll give it a try

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900