Lets say that I want to see wich way of output is faster: "printf" or "cout". I would writte something like this:
int main( void )
time_t begin, end;
begin = time( NULL );
unsigned long i;
for ( i=0 ; i<4294967295 ; i++ )
printf( "%d\n", i ); // This is for printf. If I was testing cout it would be
// cout << i << endl;
end = time( NULL );
printf( "IT TOOK: %d\n", end - begin );
My intention is not to test wich of those is faster but to have an algorithm to test the speed for any application. The problem with this implementation is that it is not very precise; computers work a lot faster than what can be measured with seconds. Any suggestions?
When I would like to know how much time it takes to execute a particulary piece of code and this piece of code is very short I read the CPU time stamp twice. (Assuming that you are running a pentium class processor) The CPU time stamp is a 64 bits counter that runs on the same frequency as your CPU does. So with this you ll be able to measure very short times very accurate.
Oke this function is written in asm for the Borland compiler.
Hi all, i want to lock a region of a file over the 32bits limit 2GB. With _locking i can't, because it only supports 32bits filesize. Does anyone know how to lock a file in a position greater than 4gb?
Is your file already open? If not, you can open the file with a exclusive lock for the entire file using OF_SHARE_DENY_NONE. See the <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/openfile.asp" rel="nofollow">OpenFile</a>[<a target=_blank title='New Window' rel='nofollow' href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/openfile.asp">^</a>] API.
Hope this helps.
Behind every great black man...
... is the police. - Conspiracy brother
Am new to VC++, and am developing a simple software with a dll, and an .exe accessing the functions of this dll.
Am statically loading the DLL into my application,and the log shows the library being loaded successfully. However when I try to execute(debug) the application(.exe), it crashes out by flashing a Developer Studio error message saying: "Could not execute:Path not found(win32 error 3)".
I M WORKING ON AN MDI APPLICATION IN WHICH A TOOLBAR HAVING COMBOBOX ON THE SELECTION OF THE ITEM OF COMBOBOX I WANT TO UPDATE DATA OF THE CHILDVIEW .
I TRIED TO CREATE THE OBJECT OF CHILDFRAME INTO CHILDDOC AND IN VIEW GETDOCUMENT FUNCTION CALLED BUT ITS GIVING ASSERTION ERROR.
I TRIED TO MAKE FIEND FUNCTION INTO CHILDFRANE IT DOESNT WORK.
I TRIED TO USE GETDLGITEMID ITS GIVING ASSERTION ERROR .