?
So geht jetzt alles.
Man muss nur die Strings am Ende einlesen.
Sieht jetzt so aus:
#include <stdio.h>
#include <string.h>
int main()
{
FILE *stindor = fopen("./stindor.mon", "r");
char name[16];
char text[128];
char typ;
int nummer = 0;
int iniangr, iniver, inispez, inilp;
fscanf(stindor, "nummer=%d iniangr=%d iniver=%d inispez=%d inilp=%d typ=%c name=%s text=%[^;] ", &nummer, &iniangr, &iniver, &inispez, &inilp, &typ, name, text);
printf("Nummer:%d\nName:%s\nText:%s\nIniAngr:%4i\nIniVer:%4d\nIniSpez:%4d\nIniLP:%4d\nTyp:%c\n", nummer, name, text, iniangr, iniver, inispez, inilp, typ);
}#include <stdio.h>
#include <string.h>
int main()
{
FILE *stindor = fopen("./stindor.mon", "r");
char name[16];
char text[128];
char typ;
int nummer = 0;
int iniangr, iniver, inispez, inilp;
fscanf(stindor, "nummer=%d iniangr=%d iniver=%d inispez=%d inilp=%d typ=%c name=%s text=%[^;] ", &nummer, &iniangr, &iniver, &inispez, &inilp, &typ, name, text);
printf("Nummer:%d\nName:%s\nText:%s\nIniAngr:%4i\nIniVer:%4d\nIniSpez:%4d\nIniLP:%4d\nTyp:%c\n", nummer, name, text, iniangr, iniver, inispez, inilp, typ);
}
stindor.mon dementsprechend so:
nummer=6
iniangr=4
iniver=2
inispez=5
inilp=7
typ=W
name=Stindor
text=Sie sind bösartige Fische.;
Danke nochmal an euch zwei. Auch für die Rechtschreibstunde