Click here to Skip to main content
15,921,174 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi, I've created new project in visual studio 2019 and import code resource from the original file. But when compiled it came with this error:

C4996: 'getch':the POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _getch
Here is the program at the place the error was showed:
int	c;

	dltXY = XY_DLT; dltAB = AB_DLT;

	flag_move = 0;
	c = getch();
	c = toupper(c);
	if (c == 'Q')
		return 1;


What I have tried:

I've tried to fix the other problem that is about
struct sockaddr_in sa
function but I don't understand this error so I'm stuck with it.
Posted
Updated 20-Oct-19 23:22pm
Comments
KarstenK 21-Oct-19 7:10am    
Understand such error messages as advice from some fellow programmer which hinted you to some bug. Maybe he isnt to good in explaining it all. :-)

1 solution

Do what the error message tells you and change the function call to _getch(). Converting VC++ 6.0 code may find a number of incompatible functions; you just have to change them to conform to the latest standards.

See Compiler Warning (level 3) C4996 | Microsoft Docs[^] for an explanation. Note that it is not recommended to disable this warning message.
 
Share this answer
 
Comments
Member 14629414 21-Oct-19 5:27am    
@Richard MacCutchan
Thank you for your reply
I've changed it into _getch()
Then i receive more errors when compiled it
Richard MacCutchan 21-Oct-19 6:23am    
Yes, and you need to look at those errors one by one and correct them.

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



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