vs2019 + v71 + v80
-
it compiled for one of the projects after some tinkering :-D i had to change the debug source files and point them to VC2003 added _CRT_SECURE_NO_DEPRECATE & _XKEYCHECK_H in preprocessors definitions and fixed some codes it runs even better than before, i have no clue how or why :laugh: ill try & do the same to the other projects and maybe i will get lucky
-
Why do you insist on using out of date toolsets? Whatever short term improvements you might see there is a potential for major problems suddenly appearing.
im not insisting on anything, im just a hobbyist, what choice do i have? im just trying to make working with these projects easier. if you like i can send you the codes and you can fix them for me, but i dont think you or anyone here would do that, so here i am only asking questions.
-
im not insisting on anything, im just a hobbyist, what choice do i have? im just trying to make working with these projects easier. if you like i can send you the codes and you can fix them for me, but i dont think you or anyone here would do that, so here i am only asking questions.
-
hmd-omani wrote:
what choice do i have?
As I keep telling you, the simple choice: use the toolset that goes with the version of Visual Studio that you are using.
-
so far so good but with my last project i got this warning c4474 saying too many arguments :( sscanf(parm, "%%.2f", &f ); i added the extra % and it removed one warning already any clues?
Too many
%
characters there. Remember in a printf/scanf format the%
is the control character, so two of them means print (or read) a single"%"
character. So in your call it expects to read a string of the form "%.2f", and requires no parameters. It should be:sscanf(parm, "%5f", &f ); // single % character to introduce the format, read up to 5 character float value.
[edit] The width value for scanf indicates the maximum number of characters to read for that field, so does not require the dot prefix, but should be large enough for the largest number. See updated code. [/edit]
-
so far so good but with my last project i got this warning c4474 saying too many arguments :( sscanf(parm, "%%.2f", &f ); i added the extra % and it removed one warning already any clues?
That’s a good example of why you should upgrade to a new toolset:
sscanf
is a variadic function with a variable number of arguments. Older toolsets didn’t bother to do any analysis on the arguments while the newer ones interpret the format string the same way it would be interpreted at runtime and check if the arguments match. In your case they don’t because the ‘%’ sign looses it’s special function if it is escaped by another ‘%’ sign. VC19 is just trying to warn you about a probable bug in your code.Mircea
-
That’s a good example of why you should upgrade to a new toolset:
sscanf
is a variadic function with a variable number of arguments. Older toolsets didn’t bother to do any analysis on the arguments while the newer ones interpret the format string the same way it would be interpreted at runtime and check if the arguments match. In your case they don’t because the ‘%’ sign looses it’s special function if it is escaped by another ‘%’ sign. VC19 is just trying to warn you about a probable bug in your code.Mircea
-
Too many
%
characters there. Remember in a printf/scanf format the%
is the control character, so two of them means print (or read) a single"%"
character. So in your call it expects to read a string of the form "%.2f", and requires no parameters. It should be:sscanf(parm, "%5f", &f ); // single % character to introduce the format, read up to 5 character float value.
[edit] The width value for scanf indicates the maximum number of characters to read for that field, so does not require the dot prefix, but should be large enough for the largest number. See updated code. [/edit]
-
why change the 2 to 5? i removed the dot between % and 2 and it worked, i dont know if thats fine or not if i kept at 2?
Because that is the maximum number of characters it will scan. So %2f will not work for 1.75, or 11.6 for example. [edit] Try this code, it will show you what I mean:
char zzz[32];
char* pp = "23.58";
float ff;
sscanf(pp, "%2f%s", &ff, zzz);
printf("Number is: %.2f\n", ff);
printf("String is: %s\n", zzz);[/edit]
-
Not sure what you mean by changing only the debug source. There are however two problems with your format specifier: - sscanf formats do not have a point for number of decimal places (unlike printf formats). - percent sign must be escaped to read a percent sign from the input. So, if you want to read something like "%12.34", the correct sscanf format is "%%%5f". VS2019 warns you if you are missing the triple percent because the last argument of sscanf will not used.
Mircea
-
not sure where to post this but i have a number of old projects that build pretty well with visual studio 2003 and 2005 but i dont want to jump around between two versions, i want to use the latest version of VS for both projects my real problem is that VS2019 platform toolset option doesnt have V71 or V80 anyway i can point it to the actual versions i have already installed to build the projects? thanks