I just created a simple program to write to a binary file in C. But the .dat or .bin file when opened through notepad or any editor it is showing the input as it was given without converting it(converting in sense is the special symbols which I have seen on other people's devices) in binary even using "wb" mode....
Please help me in this I'm sharing my code snippet here.
#include<stdio.h>
int main()
{
FILE* binFile;
binFile = fopen("OKEY.dat", "wb");
if (binFile == NULL)
printf("LOL");
else
{
char username[15];
char passwd[15];
int i = 0;
for (i = 0; i < 2; i++)
{
printf("Enter New Username:");
scanf("%s", &username);
printf("Enter New password");
scanf("%s", &passwd);
fwrite(username, sizeof(username), 1, binFile);
fwrite(passwd, sizeof(username), 1, binFile);
}
}
return 0;
}