Code:
#include <stdio.h>
main()
{
FILE *fp= fopen("binary.txt", "r"), *fp1=fopen("binary w spaces.txt","w");
int x=-1,c;
while((c = fgetc(fp))!=EOF)
{
x++;
if (x==8)
{
fputc(' ',fp1);
x=0;
}
fputc(c,fp1);
}
}
I have this file (binary.txt) with lots of 1s and 0s I got from a bitmap image (I will explain below how I did this) and I want to separate each byte with a space, that's what the code above is for. It works like that, but if I initialize x as -2 and write x==9, it displays a bunch of gibberish like this:
Code:
〰〰〱〱ㄠ〱〰〱〠〱〱〠〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〠〱〰〱〰〠〰〰〰〰〠〰〰〰〰〠〰〰ㄱㄱㄠ〰〰〰〰〠〰〰〰〰〠〰〰〰〰ㄠㄱ〱〠〰〰〰〰〠〰〰〰〰〠〰ㄱ〰〠ㄱ〱〰〰〠〰〰〰〰〠〰〰〰〰ㄠ〰〰〰〰〠〰〰〰〰〠〰〱〰〰〠〰〰ㄱ〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〠ㄱ〰〠〰〱〰〰〠〰〰〱〠〱〰ㄱ〠〰〰〰〰〠〰〰〰〰〠〱〰〠ㄱ〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰ㄱㄱㄠㄱ〱〰〰〠〰〰〰〰〠ㄱㄱㄱㄠ〰〰〰〰〠〰〰〰ㄠㄱㄱㄱ〰〠〰〰〰〰〠〰〰ㄱㄱㄠㄱ〱〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〱ㄠㄱ〰〰ㄠ〰〱〱ㄱ〠ㄱ〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰〰〰〠〰〰ㄱㄱㄠㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱ〱ㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠ〱ㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱ〱ㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱ〱ㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱ〠ㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱ〱ㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠ〱ㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱ〱ㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱ〱ㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱ〠ㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱ〱ㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠ〱ㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱ〱ㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱ〱ㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱ〠ㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱㄱㄱㄠㄱㄱ〱
Why does this happen? What do those symbols mean?
EDIT:
About the bitmap thingy, I hid some files in an image, coverted it to .bmp, then I went to cmd and wrote "type image.bmp >> file.txt". Then I used a program to convert all those characters into 1s and 0s and then I wrote the above code to separate them into groups of 8. Come to think about it, it wasn't really necessary.
Anyways, I'm just experimenting with steganography.