+ 7
[SOLVED] how do i get rid of _CTR_SECURE_NO_WARNINGS on visual studio?
and editing the project properties will not work. idk y
9 Antworten
+ 5
Did you change this
FILE * fh = fopen("file.txt", "w");
to this
FILE * fh;
int error_number = fopen_s(&fh, "file.txt", "w");
and still, the compiler issues a warning?
+ 10
Manual i found that link too.
the top answer dose not work.
the second one dose... but its just a bit of a pain for everytime i need to work with files.
I'm not sure what type of error.
+ 7
C++ Soldier (Babak) nope.
I'll try that tommorow and see if that works.
+ 6
C++ Soldier (Babak) the "secure" versions didnt work.
or do i need include the #define ?
+ 6
C++ Soldier (Babak) there is a bunch of codes ( it mainly happens when im dealing with the c standard library or files)
this one
https://code.sololearn.com/cw4E8rh41UiB/?ref=app
+ 4
As the name of the directive suggests, it suppresses those types of "Warnings" which involve C runtime (CRT) security issues regarding language constructs.
For example, in order to write some formatted data to a string, according to the documentation you have two primary choices (for un-wide chars):
1. sprintf (insecure version)
2. sprintf_s (secure version)
If you choose the first one, you end up with the above suggestion (warning). So, again you have two choices to pick from:
1. change `sprintf` to `sprintf_s`
2. Define a suppress directive "before" any header like so
#define _CRT_SECURE_NO_WARNINGS
+ 4
If you are willing to identify the root of the problem, then it's probably much better to share your code with us for a close inspection, otherwise, you can make a detour by defining the aforementioned directive at the top of the program.
+ 2
Cannot say I am fimilsr with it.
Linker error?
Or compilation error?