Very much a noob here, so it's best to assume I know nothing in any answers.
I've been writing a little app, and it's working well, but readability is a nightmare with my numbers.
Essentially, all I want to do is to add commas into the numbers displayed on the screen to make it easier to read. Is there a quick and easy way to do this?
...
I know the thread about having folds for LaTex.
However, I want folds for C++/Java when I code.
How can you have either automatic or manual folds in Emacs for C++/Java?
...
I'm trying to get into C++ programming, and I'm quite struggling against the little details. Right now, I'm trying to get the snippet below to work, and apparently it will compile, but not link. (error message is a the bottom of this post)
I'm using libsndfile to open audio files, and the linker doesn't seem to find the corrent library ...
Hi,
I have a simple OpenGL application where I have 2 objects displayed on screen:
1) particle system, where each particle is texture mapped with glTexImage2D() call. In the drawEvent function, I draw it as a GL_TRIANGLE_STRIP with 4 glVertex3f.
2) a 3D text loaded from an object file, where each point is loaded using glNewList/glGenLi...
I am trying to load a non-bmp image (png in my case) into a Bitmap/Image instance from a resource in my app. Since the Bitmap constructor only has an overload for a bitmap resource, this is what i've came around:
I allocate memory on the global heap, and then copy the resource data into it. Then I create an IStream for that global memor...
There are now so many ways to write windows apps, win32, MFC, ATL, .NET, WinForms, and probably some others that I don't know of. Which one should I choose? I'd like one that works on a fresh install of Vista, and is modern and easy to use.
...
Let's say I have a structure named vertex with a method that adds two vertices:
struct vertex {
float x, y, z;
// constructs the vertex with initial values
vertex(float ix, float iy, float iz);
// returns the value c = this + b
vertex operator+(vertex b);
};
vertex::vertex(float ix, float iy, float iz){
this->...
For example the following cast can be found littered throughout the MSDN documentation:
(LPTSTR)&lpMsgBuf
Should I bother converting that to:
static_cast<LPTSTR>(&lpMsgBuf);
Or should I just leave all the idiomatic C-esque Win32 portions as they are typically found in the docs, and save the more idiomatic C++ style/usage for the re...
How could I free up a linked list that contains dynamically allocated objects?
I try to use list<class*> lists, but then I could not use the insert() function to insert object to the list. Does anyone know what is the cause?
...
When I do
fstream someFile("something.dat", ios::binary|ios::out);
someFile.seekp(someLocation, ios::beg);
someFile.write(someData, 100);
It seems to replace the entire file with those 100 bytes instead of replacing only the appropriate 100 bytes, as if I had specified ios::trunc. Is there a portable way to not have it truncate the f...
Hi all,
I'm writing an experimental language, which is very close to pseudocode, for fun and to learn more about C++. One of the problems is that I need to parse some grammar, and my search to find a good C++ grammar parser has been unsuccessful (I couldn't find anything). What I want to accomplish is this:
set a to 4
And I want th...
I'm writing a hangman game. I'm having a logic fail, both with myself and my game logic. Char guess (the letter the person guessed) isn't being added into the correct memory slot of the vector guessArray. Assume that word is an inputted word by the user.
I assume this would work if guessArray were a raw array. Is there some reason this...
How can I call Access's Compact and Repair Database utility from within C++? I'm already using ADO and ADOX, so a solution using either of those would be handy.
...
I am new to makefiles. I learned makefile creation and other related concepts from "Managing projects with GNU make" book. The makefile is ready now and I need to make sure the one which I created is OK. Here is the makefile
#Main makefile which does the build
#makedepend flags
DFLAGS =
#Compiler flags
#if mode variable is empty, set...
I've tried to create a custom widget plugin for QT Designer following this (http://doc.trolltech.com/4.3/designer-creating-custom-widgets.html) tutorial and was somewhat successful. Basically, I can place my new widget in Designer, but it doesn't draw (I get an empty square instead of whatever I try to draw in my paintEvent method, I sta...
Hi
I'm trying to write a regular expression for my html parser.
I want to match a html tag with given attribute (eg. <div> with class="tab news selected" ) that contains one or more <a href> tags. The regexp should match the entire tag (from <div> to </div>). I always seem to get "memory exhausted" errors - my program probably takes ev...
Since I've started learning about rendering to a texture I grew to understand that glCopyTexSubImage2D() will copy the designated portion of the screen upside down. I tried a couple of simple things that came to mind in order to prevent/work around this but couldn't find an elegant solution.
there are two problems with doing a ::glScal...
I'm trying to insert some value pairs into a std::map.
In the first case, I receive a pointer to the map, dereference it and use the subscript operator to assign a value. i.e.
(*foo)[index] = bar;
Later, when I try to iterate over the collection, I'm returned key/value pairs which contain null for the value attribute in all cases ex...
I keep getting this error after my application is running for 2 days.
I've been told it's been some kind of buffer overflow, but is it the only option?
The app is written in C++ using Visual C++ 6.0.
...
In C++ sometimes in class definition public members are declared at first and privates later. But the variables or data members are normally private and used by the public methods. So, in this case variables are used but not even declared yet. Thus the code become difficult to understand. But I found renowned programmers, sites or books ...