Skip to content

C4996 (function or variable may be unsafe) error for strncpy and fopen  #138

Closed
@amuuu

Description

@amuuu

Hello,

I'm trying to integrate the header in my code but it gives me these errors:

C4996 'strncpy': This function or variable may be unsafe. Consider using `strncpy_s` instead. To disable deprecation, use `_CRT_SECURE_NO_WARNINGS`. See online help for details.	

C4996 'fopen': This function or variable may be unsafe. Consider using `fopen_s` instead. To disable deprecation, use `_CRT_SECURE_NO_WARNINGS`. See online help for details.	

I don't want to disable deprecation preferably.

I tried to change the header to use strncpy_s and fopen_s but it gave the error that std doesn't contain those functions. The global namespace has those functions but they have different headers.

Any idea how can I make it work?

Thanks in advance.

(Note, I'm using VS2022,17.4.4, C++17)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions