Files
DEV/DEV.1.1/Fichiers/ecriture-fichier/fprintf.c

17 lines
313 B
C
Raw Normal View History

2024-12-08 23:45:04 +01:00
#include <stdio.h>
#include <stdlib.h>
/*fprintf(<fichier>, <format>, ...) : écrit du texte formaté*/
int main(void){
FILE *fic = fopen("text.txt", "w");
char mot[]="Bonjour";
int age=18;
if(fic==NULL)
{exit(1);}
fprintf(fic, "J'ai %d ans %s", age, mot);
fclose(fic);
}