Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <stdio.h>
- #include <conio.h>
- #include <locale.h>
- #include <string>
- FILE *f1, *f2;
- void getWay1() {
- printf("Введите путь к первому файлу: \n");
- char way1[255];
- gets_s(way1);
- if ((f1 = fopen(way1, "r")) == NULL) {
- printf("Файл не найден\n");
- getWay1();
- }
- }
- void getWay2() {
- printf("Введите путь ко второму файлу: \n");
- char way2[255];
- gets_s(way2);
- f2 = fopen(way2, "w");
- }
- int main() {
- setlocale(LC_ALL, "Russian");
- char input[300];
- getWay1();
- getWay2();
- while (feof(f1) == 0) {
- fscanf(f1, "%s", &input);
- for (int i = 0; i < strlen(input); i++) {
- if (input[i] == '!')
- fprintf(f2, "%c", '.');
- else
- if (input[i] == ':')
- fprintf(f2, "%s", "...");
- else
- fprintf(f2, "%c", input[i]);
- }
- fprintf(f2, "\n");
- }
- fclose(f1);
- fclose(f2);
- }
- //D:\input_output\1.txt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement