1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
int main(int argc, char* argv[])
{
FILE * fichierSource = NULL;
FILE * fichierCible = NULL;
unsigned int c;
int retour;
int compteur, valeur;
if (argc != 3)
{
printf("usage: %s <nom_fichier> <nom_fichier_cible>\n", argv[0]);
exit(-1);
}
fichierSource = fopen(argv[1], "rb");
fichierCible = fopen(argv[2], "w");
if (!fichierSource || !fichierCible)
{
fprintf(stderr, "Erreur: %s\n", strerror(errno));
exit(-2);
}
compteur = 0;
valeur = 0;
while ((c = fgetc(fichierSource)) != EOF)
{
while (c == (c + 1))
{
compteur++;
fputc(compteur, fichierCible);
compteur = 1;
return EXIT_SUCCESS;
} |
Partager