Suchergebnisse für Anfrage "printf"

3 die antwort

Was ist der Unterschied zwischen printf ("% s"), printf ("% ls"), wprintf ("% s") und wprintf ("% ls")?

Betrachten Sie dieses Beispielprogramm: #include <cstdio> #include <cwchar> #include <string> int main() { std::string narrowstr = "narrow"; std::wstring widestr = L"wide"; printf("1 %s \n", narrowstr.c_str()); printf("2 %ls \n", ...

3 die antwort

Printf druckt den Müll nach dem Aufruf von read (). Der Offset wird immer als 0 @ gedruc

#include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <sys/types.h> #include <stdint.h> int main() { int file; off_t offset; if((file=open("testfile.txt",O_RDONLY)) < -1) return 1; char buffer[19]; if(read(file,buffer,19) != 19) ...

8 die antwort

Gibt es ein Sprintf-Äquivalent für node.js

Ich habe versucht, eine Ausgabe zu formatieren (Sprintf-Funktionalität) in node.js, aber bevor ich es selbst geschrieben habe, habe ich mich gefragt, ob es etwas Ähnliches gibt (ich habe die Dokumente ohne Erfolg durchgearbeitet) oder ob jemand ...

TOP-Veröffentlichungen

2 die antwort

Wie verwende ich Format String Attack

Angenommen, ich habe den folgenden Code: #include <stdio.h> #include <stdlib.h> #include <fcntl.h> int num1 = 0; int main(int argc, char **argv){ double num2; int *ptr = &num1; printf(argv[1]); if (num1== 2527){ printf("Well done"); } if(num2 ...

6 die antwort

Warum sprintf PHP nicht zuverlässig rund 5s?

Ich habe mich auf @ verlasssprintf('%0.1f', 2.25) === '2.3' aber es stellt sich heraus, dass es bei @ kom2.2! In der Tat scheint es zufällig: php > for ($j=0;$j<=10;$j++) { printf( "%s -> %0.1f\n",$j+ 0.05, $j+0.05); } 0.05 -> 0.1 // Up, as ...

2 die antwort

sprintf ungültiges Format '% d'

Das funktioniert > sprintf('%d', c(1, 1.5)) [1] "1" "1"und das nicht: > sprintf('%d', c(1.5, 1)) Error in sprintf("%d", c(1.5, 1)) : invalid format '%d'; use format %f, %e, %g or %a for numeric objectsWarum

12 die antwort

in c printf () liefert was [closed]

in c printf () gibt was zurück?

8 die antwort

Scanf for double funktioniert nicht in Dev C ++

Ich habe ein Problem mit Gleitkommazahlen. Ich glaube, hier kollidiert etwas. Die Ausgabe ist: Mein Code: #include <stdio.h> int main(){ double y; printf("enter a decimal number: "); scanf("%f", &y); printf("%f\n", y); fflush(stdin); ...

4 die antwort

Wie finde ich beim Schreiben eines Makros in C den Typ und den printf-Bezeichner für ein Argument?

Ich möchte Minunit mit dem Makro erweitern, damit es nützlicher ist. #define mu_assert_equal(actual, expected) do { \ if (actual != expected) { \ char *message = malloc(MAX_ERROR_MESSAGE_LENGTH); \ if (message == NULL) { printf("malloc failed"); ...

2 die antwort

was ist der printf in C # [duplizieren]

Diese Frage hat hier bereits eine Antwort: sprintf in C #? [/questions/313006/sprintf-in-c] 3 Antworten Ich möchte wissen, was ich in C # verwenden soll, um meine Ausgabe in meinem Konsolenfenster zu formatieren. Ich habe versucht, \ t zu ...