c++

How to find the library type (.so or .a) in C++/UNIX

Given a C++/UNIX library file (without extension), i need to determine the type of library whether it is a dynamic library (.so file) or a static library (.a file) based on its content (say grepping the content against a keyword) How do i do it in UNIX command line ? ...

Why can't the Nodes be linked together?

EDIT: Is it possible to NOT use new? (do not dynamically allocating memory) I think it is push that is wrong, but I don't know where, how, and why. here is the code: struct Node { string fileName; Node *link; }; int size(Node *&flist) { int count = 0; Node *tempPtr = flist; while (tempPtr != 0) { count += 1; ...

Is there a Java equivalent of frexp?

Is there a Java equivalent of the C / C++ function called frexp? If you aren't familiar, frexp is defined by Wikipedia to "break floating-point number down into mantissa and exponent." I am looking for an implementation with both speed and accuracy but I would rather have the accuracy if I could only choose one. This is the code sampl...

Initial Heap size alloted to a C++ program on UNIX

What is the initial heap size alloted typically to a C++ program running on UNIX based OS ? How is it decided by the g++ compiler if at all it has a role to play in this regard ? ...

compare dates in C++

Hi, i have a file, 'date.txt' which has date in it. Like, Mon Oct 13 09:37:08 2009. Now i want to compare this date with system date. How can i compare dates in C++.? I used this code to get the contents from the file 'date.txt' string date; while ( inDateFile >>date) //inDateFile is an ifstream object cout<<date<<...

( POD )freeing memory : is delete[] equal to delete ?

IP_ADAPTER_INFO *ptr=new IP_ADAPTER_INFO[100]; if i free using delete ptr; will it lead to memory leak, if not then why ? This is disassembly code generated by VS2005 **delete ptr;** 0041351D mov eax,dword ptr [ptr] 00413520 mov dword ptr [ebp-0ECh],eax 00413526 mov ecx,dword ptr [ebp-0ECh] 0041352C ...

tcmalloc: how can I get my malloc calls overridden when compiling statically?

When I use LD_PRELOAD=/usr/local/lib/libtcmalloc.so, all my calls to malloc become tcmalloc calls. However, when I link statically against libtcmalloc, I find that straight malloc is getting called unless I still use the LD_PRELOAD setting. So how can I statically compile against tcmalloc in such a way that my mallocs hook into tcmallo...

Rendering unicode characters correctly on textbox

I am working on a translation application in which users are allowed to give English input and I need to convert to a target language and display on a text box. I am facing problems in displaying unicode characters. Complex characters are not rendering correctly. I know windows uses Uniscribe for rendering complex characters. So do I ne...

How to know if a given DLL is loaded by a given process?

Possible Duplicate: How to programmatically get DLL dependencies On Windows, in a C++ program, I want to know if a given DLL (I know the path) is loaded by a given external process (I know the path of the exe), using win32 functions. It must be possible to list all DLLs loaded by a process, as process explorer does. Fabien ...

C++ Read from shared memory

Hi, I want to read status information that an application provides via shared memory. I want to use C++ in order to read the content of that named shared memory and then call it with pinvoke from a C#-class. From the software I know that it has a certain file structure: A struct STATUS_DATA with an array of four structs of SYSTEM_CHARA...

Template static variable

Hi folks! I can't understand, why if we define static variable of usual (non-template) class in header, we have linker error, but in case of templates all works fine and moreover we will have single instance of static variable among all translation units: It's template header (template.h): // template.h template<typename T> class Templ...

How to write logs to files of size 64KB in C++/VC++?

How to write logs to files of size 64KB(to allow notepad to read).Once the file has reached 64KB it should go head and create another , another ...... File names can be automatically generated. I tried the following code static int iCounter=1; CString temp; static CStdioFile f(L"c:\\Log1.txt", CFile::modeWrite | CFile::modeRead |...

New keywords and new type of pointers in Visual C++ 2005. What is managed C++?

Possible duplicates What is gcnew? What does the caret mean in C++/CLI? Difference between managed c++ and c++ I am a advanced C++ programmer with g++. But currently I am working on Visual C++ 2005 doing Windows Forms Application programming . But I am finding it hard with its new terminology. For e.g. instead of new it has gc...

Convert a C++ program to a Windows service ?

I've written a console program that "does stuff" - mainly using boost. How do I convert it to a Windows Service? What should I know about Windows Services beforehand ? Cheers! ...

How to retrieve FQDN of the current host on Win32?

What's an easiest reliable way to retrieve the fully qualified domain name of the current host in Win32? I've tried calling gethostname(), but it returns a NetBIOS name. ...

QT4 incomplete getting website content

I'm trying to write a small test using QHttp to get an URL and return its content. The program ran fine, but it has some problem. With this link http://www.mediafire.com/download.php?ztyniqhd4lb ( or some random MF link ), my program cannot load all its content. With some workaround, I found that all the SIGNAL before the done(bool) ...

How can I define operations on a template without caring what type it's instantiated with?

I have inherited a bunch of networking code that defined numerous packet types. I have to write a bunch of conversion functions that take structs of a certain type, and copy the values into other structs that have the same fields, but in a different order (as part of a convoluted partial platform bit order conversion thing -- don't ask)...

how to get USB hardware id using device id?

How to get hardware id of the usb device using device id...i am using vc++6.0 and OS is xp. is it possible by using wmi. ...

Best way to create an Environment object in C++

I want to create an environment class that is accessible from all of my classes in my program but I dont want to initialize the environment object everytime I want to access its members from my other classes. What is the best way to go around doing this in C++? I want to do this because I have the environment object store all my config ...

How to start a process on a remote machine in C++ under Windows

Hi! I'm using Dev-C++ under Windows. My question is how can i start a process on a remote machine? I know that PsExec can do that, but if it's possible, i want to avoid to use it. If someone can give some example code, i would appreciate it :) Thanks in advance! kampi ...