update
This commit is contained in:
17
DEV.1.1/Fichiers/ecriture-fichier/fprintf.c
Normal file
17
DEV.1.1/Fichiers/ecriture-fichier/fprintf.c
Normal file
@@ -0,0 +1,17 @@
|
||||
#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);
|
||||
|
||||
}
|
Reference in New Issue
Block a user