Compile:# include <stdio.h> # include <stdlib.h> # include <errno.h> int main(int argc, char **argv) { if (argc != 3) { fprintf(stderr, "Usage: %s <input_file> <comparison_file>\n", +argv[0]); exit(1); } FILE *in_file = fopen(argv[1], "r"); if (in_file == NULL) { perror(argv[1]); exit(1); } FILE *cmp_file = fopen(argv[2], "r"); if (cmp_file == NULL) { perror(argv[2]); exit(1); } for (;;) { char cmp = fgetc(cmp_file); char inp = fgetc(in_file); if (cmp == '-') { continue; } if (cmp == EOF || inp == EOF) { break; } putchar(inp); } fclose(in_file); fclose(cmp_file); exit(0); }
Usage:gcc -O3 tr_big_string.c -o tr_big_string
./tr_big_string ./big_string_file ./comparison_file
In reply to Re: How to make this substitutions without splitting the strings?
by Anonymous Monk
in thread How to make this substitutions without splitting the strings?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |