Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main (void) {
- FILE *in;
- FILE *out;
- char name[128];
- unsigned char c, d;
- int n = 0, flag = 0;
- printf ("Введите имя файла\n");
- scanf ("%s", name);
- in = fopen (name, "r");
- out = fopen ("decode.bmp", "w");
- if ((out == NULL) || (in == NULL)) {
- printf ("Файл не создан\n");
- return 0;
- }
- while (fscanf (in, "%c", &c) != EOF) {
- fscanf (in, "%c", &d);
- for (int i = 0; i < (int) c; i++) {
- fprintf (out, "%c", d);
- }
- /*if (n == 254) {
- fprintf (out, "%c%c", (unsigned char) (n + 1), d);
- n = -1;
- }
- if ((c == d) && (flag != 0)) {
- n++;
- } else {
- if (flag == 0) {
- flag++;
- d = c;
- } else {
- fprintf (out, "%c%c", (unsigned char) (n + 1), d);
- d = c;
- n = 0;
- }
- }*/
- }
- //fprintf (out, "%c%c", (unsigned char) (n + 1), d);
- fclose (in);
- fclose (out);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement