Hi,
How do I create gradients with ImageMagick in C++?
I am trying to create a visual representation of a WAV file.
I can create an Image with Magick++, draw in the waveform data and save the image as a .png file but it still looks a bit basic.
I'd like to give the image background and waveform gradients but I don't know how.
Are the...
Hi folks,
On my company system, we use a class to represent beans. It is just a holder of information using boost::variant and some serialization/deserialization stuff. It works well, but we have a problem: it is not over an interface, and since we use modularization through dlls, building an interface for it is getting very complicated...
Please could someone give me a few tips for creating function pointers for MS winapi functions? I'm trying to create a pointer for DefWindowProc (DefWindowProcA/DefWindowProcW) but getting this error:
LRESULT (*dwp)(HWND, UINT, WPARAM, LPARAM) = &DefWindowProc;
error C2440: 'initializing' : cannot convert from
'LRESULT (__stdcall *)(H...
So I have something like this
#define HASHSIZE 1010081
static struct nlist *hashtab[HASHSIZE];
Now I want to be able to change the HASHSIZE of my hashtab, because I want to test different primes numbers and see which would give me less collisions. But Arrays do not take variable sizes so HASHSIZE has to be a constant. Is there a way ...
Can it be done before compiling, by comparing code? Is there any tools already doing this?
...
cramming for a c++ exam, on string manip with some example questions (to which i dont have solutions) - below is today's handiwork. although it works fine - would be awesome if any obvious lapses / better way of doing things occur to you, just drop me a quick note, i need to learn me some C++ fast :)
thanks!
#include <iostream>
#includ...
Hello,
I'm trying to do something like Rainmeter do to its windows, that is use the full transparency in a window but we still read the text of each window.
Anyone can explain me how this is done? how we set the full transparency in a window and show certain parts of this window (like text or other things).
I can do this with regions ...
I'm frequently run into a situation where I need to report in some way that a finding an item has failed. Since there are many ways how to deal with such a situation I'm always unsure how to do it. Here are a few examples:
class ItemCollection
{
public:
// Return size of collection if not found.
size_t getIndex(Item * inItem)
...
How do you switch pointers in a function?
void ChangePointers(int *p_intP1, int *p_intP2);
int main() {
int i = 100, j = 500;
int *intP1, *intP2; /* pointers */
intP1 = &i;
intP2 = &j;
printf("%d\n", *intP1); /* prints 100 (i) */
printf("%d\n", *intP2); /* prints 500 (j) */
ChangePointers(intP1, intP2);
printf("%d\n", *intP1); /* ...
for certain functions i want to create a copy of the string within the function and then manipulate this - for some strange reason, i cant get strcpy to work (gives me a segmentation fault) - i've also tried passing the arg as a string, this doesnt work either (g++ throws an error saying it expect a char*)
#include <iostream>
#include ...
I'm looking at protobuf-net for implementing various messaging formats, and I particularly like the contract-based approach as I don't have to mess with the proto compiler. one thing I couldn't quite find information on is, does this make it difficult to work cross-platform? there are a few C++ apps that would need to be able to parse PB...
Hi,
I am preparing the interview questions not for homework. There is one question about how to multiple very very long integer. Could anybody offer any source code in C++ to learn from? I am trying to reduce the gap between myself and others by learning other's solution to improve myself.
Thanks so much!
Sorry if you think this is n...
When is the string literal "hello" allocated and deallocated during the lifetime of the program in this example?
init(char **s)
{
*s = "hello";
}
int f()
{
char *s = 0;
init(&s);
printf("%s\n", s);
return 0;
}
...
#define ROW 3
#define COL 4
class Matrix
{
private:
int mat[ROW][COL];
//.....
//.....
};
int main()
{
Matrix m;
int a = m[0][1]; // reading
m[0][2] = m[1][1]; // writing
}
I think directly it not possible to overload [][] .
I think i have to do it indirectly but how to implement it?
...
can someone tell me what is the different between (*ptr).field and ptr->field?
I know it connect somehow to static and dynamic linking, but i dont know what is it.
can someone tell me the differnet and give me an example?
edit:
if i have this code:
Point p; //point is a class that derive from class shape
Shape *s=&p;
...
I spent some time removing all the uninfluent code and here is my problem.
--- File.h ---
#include <fstream>
#include <string>
template <typename Element>
class DataOutput : public std::basic_ofstream<Element>
{
public:
DataOutput(const std::string &strPath, bool bAppend, bool bBinary)
: std::basic_ofstream<Element>(
s...
I have a core file I am examining. And I am just stumped at what can be the possible causes for this. Here is the behavoir:
extern sampleclas* someobj;
void func()
{
someobj->MemFuncCall("This is a sample str");
}
My crash is inside MemFuncCall. But when I examine core file, someobj has an address, say abc(this address is properly...
I have been looking through some code and I have seen several examples where the first element of a for cycle is omitted.
An example:
for ( ; hole*2 <= currentSize; hole = child)
What does this mean?
Thanks.
...
Hi,
i defined boost::multi_array with
typedef boost::multi_array<unsigned int, 1> uint_1d_vec_t;
typedef boost::multi_array<unsigned int, 2> uint_2d_vec_t;
uint_1d_vec_t foo( boost::extents[ num_elements ] );
uint_2d_vec_t boo( boost::extents[ num_elements/2 ][ kappa ] );
were num_elements/2 ist an integer number...
Hi, I was comparing a simple hash function that I wrote which just multiplies it by a prime mod another prime number (the table size) and it turns out that stl is slower by 100 times. This is the test method that I wrote:
stdext:: hash_map<string, int> hashDict;
for (int l = 0; l < size; ++l){
hashDict[arr[l]] = l;
}
long int before...