1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
void load()
{
ifstream readF ("3mb.txt");
string output; string out;
if(readF.is_open())
{
while(!readF.eof())
{
getline(readF,out);
output=output+'\n'+out;
}
readF.close();
//cout<<output<<endl;
//cout<<output.size()<<endl;
text[0]=output;
}
else
cout<<"couldnt open file!"<<endl;
}
unsigned Counter;
unsigned __stdcall SecondThreadFunc( void* pArguments )
{
cout<<"encrypting..."<<endl;
Enc(text[0]);
_endthreadex( 0 );
return 0;
}
unsigned __stdcall SecondThreadFunc2( void* pArguments )
{
cout<<"encrypting..."<<endl;
//Enc(text[0]);
_endthreadex( 0 );
return 0;
}
int main()
{
load();
HANDLE hThread[10];
unsigned threadID;
time_t start, end;
start =time(0);
hThread[0] = (HANDLE)_beginthreadex( NULL, 0, &SecondThreadFunc, NULL, 0, &threadID );
hThread[1] = (HANDLE)_beginthreadex( NULL, 0, &SecondThreadFunc2, NULL, 0, &threadID );
WaitForSingleObject( hThread[0], INFINITE );
WaitForSingleObject( hThread[1], INFINITE );
CloseHandle( hThread[0] );
end=time(0);
cout<<"Time taken : "<<difftime(end, start) << "second(s)" << endl;
system("pause");
}
|