sprintf format
-
Hallo
sprintf(buffb,"Crz FF: %4.2f\n", C_FF);resultiert in:
format ‘%f’ expects argument of type ‘double’, but argument 3 has type ‘float*’ [-Wformat]
Wie soll den float formatieren?
Vielen Dank
Michael
-
*C_FF
-
das hier klappt bei mir:
char buffb[54365]; float C_FF = 25.9845f; sprintf(buffb,"Crz FF: %4.2f\n", C_FF);
das hier auch:
char buffb[54365]; float * C_FF = new float(25.9845f); sprintf(buffb,"Crz FF: %4.2f\n", *C_FF);
aber das ist C und nicht C++. Zumal die Fehler auch erst zur Laufzeit festgestellt werden.
-
Genauer hinschauen, da steht float* (mit *), also ein Zeiger.
double und float (ohnehaben beide den Formatspecifier %f.
C kennt kein new.
-
int new;
Jetzt schon! Wir sind im C++ Forum :p