OpenCores
URL https://opencores.org/ocsvn/miniuart2/miniuart2/trunk

Subversion Repositories miniuart2

[/] [miniuart2/] [trunk/] [sw/] [TestCom/] [mainFr.cpp] - Blame information for rev 26

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 philippe
//---------------------------------------------------------------------------
2
#include <stdio.h>
3
#include <io.h>
4
#pragma hdrstop
5
 
6
//---------------------------------------------------------------------------
7
 
8
 
9
#pragma argsused
10
int main(int argc, char* argv[])
11
{
12
   FILE *fs,*fd;
13
   char line[200];
14
   int l = 0;
15
 
16
   if (argc != 3)
17
   {
18
      printf("Filtre de fichiers texte\n");
19
      printf("Syntaxe:\n");
20
      printf("FILTER File1 File2\n");
21
      printf("\tFile1 = Fichier source\n");
22
      printf("\tFile2 = Fichier destination\n");
23
      return 0;
24
   }
25
 
26
   fs = fopen(argv[1], "rt");
27
   if (fs == NULL)
28
   {
29
      printf("Impossible d'ouvrir %s\n", argv[1]);
30
      return 0;
31
   }
32
 
33
   fd = fopen(argv[2], "wt");
34
   if (fd == NULL)
35
   {
36
      printf("Impossible d'ouvrir %s\n", argv[2]);
37
      fclose(fs);
38
      return 0;
39
   }
40
 
41
   while(fgets(line, 200, fs) != NULL)
42
   {
43
      l++;
44
      if (l <= 1 || l > 6)fprintf(fd, "%s", line);
45
   }
46
 
47
   fclose(fs);
48
   fclose(fd);
49
}
50
//---------------------------------------------------------------------------

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.