Code: Alles auswählen
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
FILE *fp;
char text[255];
char string[] = "Hallo";
if(fp = fopen("Datei.dat", "w+") == NULL) {
printf("Probleme beim öffnen\n");
exit(1);
}
fputs(string, fp);
fgets(text,5,fp);
printf("Das ist der Text: %s", text);
fclose(fp);
return 0;
}