My tested bacteria
This commit is contained in:
parent
d1de32c0ea
commit
c1dd12c407
1 changed files with 42 additions and 43 deletions
|
@ -8,7 +8,7 @@ using namespace std;
|
||||||
|
|
||||||
int file_size(const char *filename){
|
int file_size(const char *filename){
|
||||||
ifstream ifile;
|
ifstream ifile;
|
||||||
ifile.open(filename, ios_base::binary | ios_base::ate);
|
ifile.open(filename, ios_base::binary | ios_base::ate);
|
||||||
int size = ifile.tellg();
|
int size = ifile.tellg();
|
||||||
ifile.close();
|
ifile.close();
|
||||||
return size;
|
return size;
|
||||||
|
@ -19,10 +19,9 @@ int main(int argc,char** argv) {
|
||||||
// Read my own program
|
// Read my own program
|
||||||
ifstream ifile;
|
ifstream ifile;
|
||||||
ifile.open(argv[0], ios::binary) ;
|
ifile.open(argv[0], ios::binary) ;
|
||||||
int filesize = file_size(argv[0]);
|
|
||||||
srand( time(NULL) );
|
srand( time(NULL) );
|
||||||
|
int filesize = file_size(argv[0]);
|
||||||
int rand_byte = rand() % ( filesize + 1 );
|
int rand_byte = rand() % ( filesize + 1 );
|
||||||
|
|
||||||
// Devide
|
// Devide
|
||||||
ofstream ofile;
|
ofstream ofile;
|
||||||
string filename = tempnam(".", "bact-");
|
string filename = tempnam(".", "bact-");
|
||||||
|
|
Loading…
Add table
Reference in a new issue