
Ich wollte versuchen ein SDL-enum aus einer Datei mit fscanf auszulesen. Aber irgendwie weigert sich der Compiler das zu akzeptieren.
Diese Struktur hab ich selbst angelegt:
Code: Alles auswählen
typedef struct
{
SDLKey up;
SDLKey right;
SDLKey down;
SDLKey left;
} keys;
Code: Alles auswählen
typedef enum {
/* The keyboard syms have been cleverly chosen to map to ASCII */
SDLK_UNKNOWN = 0,
SDLK_FIRST = 0,
SDLK_BACKSPACE = 8,
SDLK_TAB = 9,
[...]
SDLK_POWER = 320, /* Power Macintosh power key */
SDLK_EURO = 321, /* Some european keyboards */
SDLK_UNDO = 322, /* Atari keyboard has Undo */
/* Add any other keys here */
SDLK_LAST
} SDLKey;
Code: Alles auswählen
fprintf (config, "UP: %d\nRIGHT: %d\nDOWN: %d\nLEFT: %d",
k -> up, k -> right, k -> down, k -> left);
Bei
Code: Alles auswählen
fscanf (config, "UP: %d\nRIGHT: %d\nDOWN: %d\nLEFT: %d",
&k -> up, &k -> right, &k -> down, &k -> left);
Code: Alles auswählen
EatTheBlocks.c: In Funktion »load_config«:
EatTheBlocks.c:270: Warnung: format »%d« erwartet Typ »int *«, aber Argument 3 hat Typ »enum SDLKey *«
EatTheBlocks.c:270: Warnung: format »%d« erwartet Typ »int *«, aber Argument 4 hat Typ »enum SDLKey *«
EatTheBlocks.c:270: Warnung: format »%d« erwartet Typ »int *«, aber Argument 5 hat Typ »enum SDLKey *«
EatTheBlocks.c:270: Warnung: format »%d« erwartet Typ »int *«, aber Argument 6 hat Typ »enum SDLKey *«