The reason I use here binary file because using binary file we can both read and write easily
#include<bits/stdc++.h>
using namespace std;
int main ()
{
string s ="";
fstream file("compress.bin", ios:: binary | ios::in | ios::out | ios:: trunc);
for(int i= 0; i<256; i++)
{
char c=i;
file.write((char *)&c,sizeof(c));
}
}
No comments:
Post a Comment