#include <stdio.h>
#include <string.h>
Go to the source code of this file.
|
| int | main (int argc, char *argv[]) |
◆ main()
| int main |
( |
int | argc, |
|
|
char * | argv[] ) |
Definition at line 6 of file Ejemplo042.c.
7{
8 int i, n;
9 FILE *fp;
11 printf("Ingrese el valor de n: ");
12 scanf("%d", &n);
13 if(argc==2)
14 strcpy(filename, argv[1]);
15 else
16 strcpy(filename, "Prueba.txt");
17 fp = fopen(filename, "wt");
18 if(fp==NULL)
19 return 1;
20 for(i=0; i<n; i++)
21 fprintf(fp, "%d\n", i+1);
22 fclose(fp);
23 return 0;
24}