Search found 2560 matches

by Neo
Fri Jul 31, 2009 3:53 pm
Forum: C/C++ Programming
Topic: How to get the CPU time?
Replies: 1
Views: 2866

Re: How to get the CPU time?

Hi Kevin,

You can do it as follows.

Code: Select all

NTSTATUS hStatus;
SYSTEM_PERFORMANCE_INFORMATION sysPInfo;

hStatus = NtQuerySystemInformation(SystemPerformanceInformation, &sysPInfo, sizeof(sysPInfo), NULL);
if (hStatus != NO_ERROR){
       // Your code here
}
BR,

Neo
by Neo
Fri Jul 31, 2009 3:33 pm
Forum: C/C++ Programming
Topic: What's the best way to time a function in VC++?
Replies: 2
Views: 3470

Re: What's the best way to time a function in VC++?

Hi Shane, Yes, there are few methods for this. clock() function is not accurate at all. Refer the following table. Average Error(ms) Resolution (Error x 2) (ms) clock () 27 55 _ftime () 27 55 GetTickCount () 10 20 Multimedia Timer 1 2 So GetTickCount and Multimedia Timer are the most accurate ways t...
by Neo
Wed Jul 22, 2009 9:00 pm
Forum: C/C++ Programming
Topic: How to print unsigned __int64 using printf
Replies: 1
Views: 3783

Re: How to print unsigned __int64 using printf

The following code will do the thing on MS VC 6.0.

Code: Select all

printf("value using I64d: %I64d\n", value);
printf("value using I64x: %016I64x(hex)\n", value);
Hope this will help.

Neo
by Neo
Tue Jul 21, 2009 4:03 pm
Forum: Windows
Topic: How to enable Task Manager in Win XP
Replies: 2
Views: 3915

Re: How to enable Task Manager in Win XP

Here is a registry hack to enable or disable Windows NT TaskManager. The same registry hack applies to Windows 2000 and Windows XP. Hive: HKEY_CURRENT_USER Key: Software\Microsoft\Windows\CurrentVersion\Policies\System Name: DisableTaskMgr Type: REG_DWORD Value: 1=Enablethis key, that is DISABLE Tas...
by Neo
Tue Jul 21, 2009 3:28 pm
Forum: C/C++ Programming
Topic: C++ inheritance
Replies: 1
Views: 2921

Re: C++ inheritance

You can access varaible 'a' of derived class A as A::a
by Neo
Tue Jul 21, 2009 3:26 pm
Forum: C/C++ Programming
Topic: Command line argument
Replies: 1
Views: 2999

Re: Command line argument

To accept command line arguments, we need to define the main() as follows. int main ( int argc, char *argv[] ) argc is the number of arguments passed in command line argv is an array of C strings with the value of the arguments passed to your program Note that argv[0] is always the name of your prog...
by Neo
Tue Jul 21, 2009 3:24 pm
Forum: C/C++ Programming
Topic: Delete a file from code
Replies: 1
Views: 2760

Re: Delete a file from code

int remove ( const char * filename );

If the file is successfully deleted, a zero value is returned.
On failure, a nonzero value is reurned and the errno variable is set to the corresponding error code.
by Neo
Tue Jul 21, 2009 3:20 pm
Forum: C/C++ Programming
Topic: Differance in arrays
Replies: 2
Views: 3537

Re: Differance in arrays

There two ways to define arrays in C++. Static and dynamic definitions. int myArray[256]; // Static definition int *myArray = new int[256]; // Dynamic definition When accessing the arrays there is no difference. However Static arrays are created at function load-time and the size of the array is fix...
by Neo
Tue Jul 21, 2009 3:00 pm
Forum: C/C++ Programming
Topic: Function pointers...
Replies: 2
Views: 3633

Re: Function pointers...

First you need to define a type for the function prototype. For example: typedef void (*myFuncType) (); The above function type defines a void function with no parameters. Ex: void myFunction1() { } Now you need to define the function array as below. /* Function pointer array */ const myFuncType myF...
by Neo
Sun Jul 19, 2009 8:04 pm
Forum: C/C++ Programming
Topic: Opening a sequence of files inside a loop
Replies: 1
Views: 2848

Re: Opening a sequence of files inside a loop

you can use sprintf instead as below. char filename[50]; // to hold the filename FILE *fp; for (............ { sprintf ( filename, "C:/path/bitmap%.2d.bmp", i); // %.2d will add zeros to the left and make the width exactly 2 fp = fopen (filename, "rb"); //for binary reading (ANSI C) fread(buf, ..., ...

Go to advanced search