c++

How can I convert wav to MP3 programmatically in C++?

How can I convert wav to MP3 programatically in C++? ...

How to initialize a static const map in c++?

Hi, I need just dictionary or asociative array string => int. There is type map C++ for this case. But I need make one map in my class make for all instances(-> static) and this map cannot be changed(-> const); I have found this way with boost library std::map<int, char> example = boost::assign::map_list_of(1, 'a') (2, 'b') (3...

How can I get identity of a disk?

I want to identify disk in c++ in my windows application. For example: I have a disk on E:\ Then I changed the disk, and replace it with another one. the name is still E:\ How can I know the disk is changed, it is not the original one? If I have no administrator priority in win7, Can I still use some method to identy different disks? ...

Read multiple strings from a file C++

Hi I need to read different values stored in a file one by one. So I was thinking I can use ifstream to open the file, but since the file is set up in such a way that a line might contain three numbers, and the other line one number or two numbers I'm not sure how to read each number one by one. I was thinking of using stringstream but...

HTML file: add annotations through IHTMLDocument

I need to add "annotations" to existing HTML documents - best in the form of string property values I can read & write by name. Apparently (to me), meta elements in the header seem to be the common way - i.e. adding/modifying elements like <head> <meta name="unique-id_property-name" content="property-value"/> ... </head> Questio...

Question about compilers and how they work

This is the C code that frees memory of a singly linked list. It is compiled with Visual C++ 2008 and code works as it should be. /* Program done, so free allocated memory */ current = head; struct film * temp; temp = current; while (current != NULL) { temp = current->next; free(current); current = temp; } But I also encou...

Remove unwanted lines,dead code from source code?

How to make source code free of the following Remove dead codes that are more than few lines between /* c++ codes */ Change more than one line breaks to one Remove modified user name and date /*-------- MODIFICATION DONE by xyz on ------------*/ I have used a code formatter tool to get a nice formatted code but stuck with code with a...

Microsoft Detours - DetourUpdateThread?

Hi, I have a few quick questions about the Microsoft Detours Library. I have used it before (successfully), but I just had a thought about this function: LONG DetourUpdateThread(HANDLE hThread); I read elsewhere that this function will actually suspend the thread until the transaction completes. This seems odd since most sample code c...

How to detect first or last element iterating over a container?

How to do the following in more stylish/short way? for(i=container.begin(); i!=container.end(); ++i) { if (i!=container.begin()) { cout << ", "; } cout << *i; j=i; if (++j==container.end()) { cout << "!" << endl; } } Solutions like foreach are acceptable (actions on first and last elements need...

how to generate String difference vectors?

Hi Guys, a bit of a vague question but I am looking for pointers as to how can I generate String diff vectors in C++. The scenario is such that given a paragraph I want to store the various differences(Edit, cut copy paste etc.) it goes through in a draft mode to review Audit history. Any hints in this regard will be really appreciated...

Create unmanaged c++ object in c#

I have an unmanaged dll with a class "MyClass" in it. Now is there a way to create an instance of this class in C# code? To call its constructor? I tried but the visual studio reports an error with a message that this memory area is corrupted or something. Thanks in advance ...

Is there any C/C++ opensource library for Content Aware Image transformations?

I need it to have at least such features like Content Aware Fill, Content Aware Image Resizing. I need it as normal C/C++ library, usable from code, may be with dependencies on other open source libraris. But with examples of code compilable into stand alone applications! So is there any such library? Is there any C or C++ opensour...

Updating Pointer using signals and slots

Hi, I am very new to the QT; please help me to solve the problem. I am using thread to perform intensive operation in back ground. Meanwhile I want to update the UI, so I am using SIGNALS and SLOTS. To update UI I emit a signal and update UI. Let us consider bellow sample code, struct sample { QString name; QString addr...

Problem Loading multiple textures using multiple shaders with GLSL

I am trying to use multiple textures in the same scene but no matter what I try the same texture is loaded for each object. So this what I am doing at the moment, I initialise each shader: rightWall.SendShaders("wall.vert","wall.frag","brick3.bmp", "wallTex", 0); demoFloor.SendShaders("floor.vert","floor.frag","dirt1.bmp", "floor...

class which cannot be derived

I found this code here class Usable; class Usable_lock { friend class Usable; private: Usable_lock() {} Usable_lock(const Usable_lock&) {} }; class Usable : public virtual Usable_lock { // ... public: Usable(); Usable(char*); // ... }; Usable a; class DD : public Usable { }; DD dd; // error: DD::DD() ca...

Python and C++ Sockets converting packet data

First of all, to clarify my goal: There exist two programs written in C in our laboratory. I am working on a Proxy Server (bidirectional) for them (which will also mainpulate the data). And I want to write that proxy server in Python. It is important to know that I know close to nothing about these two programs, I only know the definitio...

Creating simple c++.net wrapper. Step-by-step

I've a c++ project. I admit that I'm a complete ZERO in c++. But still I need to write a c++.net wrapper so I could work with an unmanaged c++ library using it. So what I have: 1) unmanaged project's header files. 2) unmanaged project's libraries (.dll's and .lib's) 3) an empty C++.NET project which I plan to use as a wrapper for my c# a...

where does main() return its value?

I'm newly using CODE::BLOCKS+mingw compiler If I don't type return 0 at the end of program,I can see that main() is returning some integer,I learnt that main() returning 0 infers program executes successfully.I don't find any flaw in my code, why is it returning some integer? secondly any function returns its value to its function call,...

[C++] Is it possible to roll a significantly faster version of sqrt

In an app I'm profiling, I found that in some scenarios this function is able to take over 10% of total execution time. I've seen discussion over the years of faster sqrt implementations using sneaky floating-point trickery, but I don't know if such things are outdated on modern CPUs. MSVC++ 2008 compiler is being used, for reference.....

[C++] Is it possible to roll a significantly faster version of modf

In an app I'm profiling, I found that in some scenarios this function is able to take over 10% of total execution time. MSVC++ 2008 compiler is being used, for reference... I don't recall if modf maps to a single instruction or if there is likely any way to make it faster. see also here for similar question on sqrt function Unlike sqr...