initial import
[staff/goc4/2018bti7061.git] / c-5-structuresFiles / examples / c-files / writeFile.c
1 #include <stdio.h>
2
3 int main(){
4 FILE *file_pointer;
5 file_pointer = fopen("output.txt","w");
6 puts("Type a number");
7 int nb;
8 scanf(" %d",&nb);
9
10 fprintf(file_pointer,"Hello world\n");
11 int i;
12 for(i=0;i<nb;i++){
13 fprintf(file_pointer,"%d",i);
14 }
15
16 fclose(file_pointer);
17
18
19
20
21
22 }