Sunday, March 25, 2012
Sunday, January 10, 2010
Print 64 -bit Integer in Windows
Microsoft use different way to print 64bit unsigned Integer; it uses "I64" instead of "ll":
EXAMPLE:
INT64 x = 1234567890123456;
printf("The 64 bit number is: %I64d\n",x;)
EXAMPLE:
INT64 x = 1234567890123456;
printf("The 64 bit number is: %I64d\n",x;)
Sunday, September 27, 2009
Tuesday, August 18, 2009
Wednesday, August 12, 2009
Use Extern function in a library (C++)
Here is an example of usage of extern function in a (Static) Library.
stw.h:
#ifdef __cplusplus
extern "C"
#endif
void show_the_world(void);
stw.cpp:
#include
#include "stw.h"
using namespace std;
extern "C" void show_the_world() {
cout << "Hello, world!\n";
}
Build the library:
$ g++ -c stw.cpp -o stw.cpp -O0 -g
$ ar rcs stw.a stw.o
Using the library from a C application:
myapp.c:
#include "stw.h"
int main() {
show_the_world();
return 0;
}
Building the C application:
$ gcc -o myapp myapp.c stw.a -lstdc++ -g -O0
$ ./myapp
Hello, world!
$
Thursday, July 30, 2009
Katuweda is a code repository.
Katuweda contains simple reusable codes. Those are may be Function or class.
Subscribe to:
Posts (Atom)