Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <unistd.h>
- int main(int argc, char *argv[])
- {
- //fejléc
- if (system("cls")) system("clear");
- printf("=====PiConcat by Shuffle=====\n");
- //paraméterek beolvasása
- if (argc != 2)
- {
- printf("Adja meg az egyes fájlokban található számjegyek számát (pl 10000)!\n");
- return 0;
- }
- int lepes;
- lepes = atoi(argv[1]);
- if (lepes == 0){
- printf("Hibás paraméter!\n");
- return 0;
- }
- ///összefésülés
- //fájlok
- char fileName[FILENAME_MAX];
- char destName[FILENAME_MAX];
- char filech;
- sprintf(destName, "PiGen_%d_FULL.txt", lepes);
- printf("Fájl írása: %s\n", destName );
- FILE *source, *dest;
- dest = fopen(destName ,"a+");
- int resz = 1;
- sprintf(fileName, "PiGen_%d_%d.txt", lepes, resz);
- while( access( fileName, F_OK ) != -1 ) {
- printf("Talált fájl: %s", fileName );
- source = fopen(fileName ,"r");
- if ( source == NULL )
- {
- printf(" (sikertelen)\nMegszakítva!\n");
- return 0;
- }
- //másolás
- while(1)
- {
- filech = fgetc(source);
- if ( filech == EOF )
- break;
- else
- fputc(filech, dest);
- }
- fclose(source);
- //léptetés és új név generálása
- printf(" (kész)\n");
- resz++;
- sprintf(fileName, "PiGen_%d_%d.txt", lepes, resz);
- }
- if (resz == 1)
- printf("Figyelem! Nem található az egyes számú részeredmény: PiGen_%d_1.txt\n",lepes);
- fclose(dest);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement