ejercicio de argchivos

This commit is contained in:
2026-11-12 11:27:34 -03:00
parent 361de2745c
commit 913efb475b
7 changed files with 135 additions and 0 deletions
BIN
View File
Binary file not shown.
+3
View File
@@ -0,0 +1,3 @@
ESTE ES UN ARCHIVO
DE PRUEBAS DONDE VAMOS A EVALUAR COMO
SE COPIA ESTE CORREO HORACIODRS@GMAIL.COM
+44
View File
@@ -0,0 +1,44 @@
#include <ctype.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[]) {
char *src = "src-test.txt";
char *dst = "dst-test.txt";
if (argc == 3) {
src = strdup(argv[1]);
dst = strdup(argv[2]);
} else {
fprintf(stderr, "Argumentos invalidos.\n");
return 1;
}
FILE *fpsrc, *fpdst;
fpsrc = fopen(src, "r");
if (fpsrc == NULL) {
perror("fopen");
return 1;
}
fpdst = fopen(dst, "w");
if (fpdst == NULL) {
perror("fopen");
return 1;
}
int c;
while ((c = fgetc(fpsrc)) && c != EOF) {
fputc(toupper(c), fpdst);
}
fclose(fpsrc);
fclose(fpdst);
printf("Archivo duplicado en mayusculas con exito en: %s\n", dst);
return 0;
}
+3
View File
@@ -0,0 +1,3 @@
Este es un archivo
de pruebas donde vamos a evaluar como
se copia este correo horaciodrs@gmail.com