Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdlib.h>
- #include<stdio.h>
- FILE *otevriVstupniSoubor() {
- FILE *soubor;
- char jmenoSouboru[40];
- printf("zadej jmeno vstupniho souboru: ");
- scanf("%s", jmenoSouboru);
- soubor = fopen(jmenoSouboru, "r");
- if (!soubor) {
- printf("souboru nenalezen\n");
- exit(1);
- }
- return soubor;
- }
- FILE *otevriVystupniSoubor() {
- FILE *soubor;
- char jmenoSouboru[40];
- printf("zadej jmeno vystupniho souboru: ");
- scanf("%s", jmenoSouboru);
- soubor = fopen(jmenoSouboru, "w");
- if (!soubor) {
- printf("souboru nenalezen\n");
- exit(1);
- }
- return soubor;
- }
- int main(void) {
- int cislo, soucet = 0, c;
- FILE *soubor_in = otevriVstupniSoubor();
- FILE *soubor_out = otevriVystupniSoubor();
- while (1){
- c = fgetc(soubor_in);
- if (c == EOF){
- break;
- }
- fputc(c, soubor_out);
- }
- fclose(soubor_in);
- fclose(soubor_out);
- return 0;
- }
Add Comment
Please, Sign In to add comment