General C++ Programming - September 2009

by sporx
writing words from txt to an array and remove duplicate
 
Hi, im working on a program that reads from a text document. the first line has a number, that suppose to say how long the array suppose to be, and each other l...
[2 replies] Last: #include <iostream> #include <fstream> #include <string> #include ... (by Fenor)
How excpose and internal stl collection as read-only in my API?
 
I have a collection, as an example, based of type std::vector<MyClass>. How can I create a collection wrapper class that exposes only a count() property and an...
[2 replies] Last: Containment of an STL container is better than derivation since none o... (by jsmith)
by Duncan
Color Key Question (Alpha Gradient?)
 
Hey everyone. My artist wants to do a kind of gradient in his art for our simple 2D game. He wants to do something like Green fading to Transparent. I could har...
[4 replies] Last: The SDL_SetColorKey() function is for binary transparency (off or on).... (by Duthomhas)
Most random bug ever?
 
Heya! I'm currently programming in VC++ 2008 and I've come to face atleast to me the most random bug ever. I'm in a update function which is called each fra...
[8 replies] Last: ic ic I was thinking this one was for language and concept type thi... (by turbozedd)
Why not cross-platform?
 
In certain occasions I might be able to understand. But when people write servers that are clearly able to become cross-platform and/or even more effecient, the...
[4 replies] Last: In the environment I work in, if you can't test it, you can't say it ... (by helios)
open() method not working for multiple files.
 
Hello all, I am using ifstream to open a file. I have a loop that opens and reads from all of the files (.txt) in a directory. It reads the contents then c...
[2 replies] Last: Awesome, that does the trick. Thanks Firedraco! (by flightdeck)
by PkD
friend class
 
Is it possible to do like this: class B; class A { friend class B int mA;}; class B : public A { B * B::getSomeThing() } What I want to know...
[4 replies] Last: Yes of course you can use it and agreed buffbill it breaks encapsulati... (by behlkush)
GetPrivateProfileInt not working in windows 7
 
I am calling GetPrivateProfileInt (_T("SectionName"), _T("KeyName"), 0,_T("C:\\Documents and Settings\\Desktop\\abc.ini")) in Windows 7. It returns an error "F...
[no replies]
delete char * in structure
 
My code keeps giving debug assertion error.. Here is my code.. #include "stdafx.h" #include "iostream.h" #include "stdlib.h" struct Test { char *valu...
[13 replies] Last: It can still have a destructor. struct Test { char *value;... (by Chewbob)
by devas
pointer initialization
 
hi, i have some diffuculties in understanding a sample code: #define MAX 32 #define MIN 1 #define NUMBER_OF_CARD MAX*MIN typedef float BUFFER ; ty...
[2 replies] Last: thanks a lot :) (by devas)
stuck on new school project
 
hey, I just started taking c++ and did the first couple projects ok but this one has me stumped. a large company pays salespeople on a commission basis. The sal...
[5 replies] Last: Use code tags... the # icon on the right. Read your book, cin/cout ... (by turbozedd)
Opening file multiple times results in error
 
For this assignment, I need to create and populate a stack based on either user input (which works fine) or file. If it's in a file, then I have to populate wit...
[3 replies] Last: Thanks, I was planning on doing something similar later on-although I ... (by demosthenes2k8)
Khurram
 
Thanks mcleano, Could you please list me some free IDE's for writing C++ programs on? Regards, Khurram
[4 replies] Last: MS-Visual C++ (powerful debugger, microsoft related ) Had to lol a... (by mcleano)
compare 3 objects and return 1, -1, or 0
 
i have 3 objects, first name, lastname, units done, credits earned well the all have different units and credits, so im supposed to compare all three and ret...
[2 replies] Last: Put your student objects in an array or vector, implement the less tha... (by turbozedd)
Data Type Modifiers
 
signed, unsigned, short and long Why do data type modifiers only work on built in types? Why can't you make a custom data type modifier?
[6 replies] Last: Sorry: http://www.google.com/search?q=radical+language+modification (by Duthomhas)
Key Binding & Input
 
I have a very complex key binding and input system I have created that is for the most part hardcoded and the player cannot modify any settings. There are actu...
[3 replies] Last: Yes, that would work as well, I think std::map's lookup is faster, but... (by firedraco)
Generate binary numbers
 
Hi, I am trying to generate all the binary numbers of length 3, and in order. I'm not allowed to use any special libraries or stuff like that to get the soluti...
[2 replies] Last: Thanks Duoas! It did. I did it both ways, using your method based ... (by barneyTdino)
Contradictory results produced by sizeof
 
In a class, I have to define a constant member initialized in the constructor initializer list and an untagged enumeration to determine the size of an array. I ...
[3 replies] Last: Many thanks to Zhuge and Hamsterman for their comments. Hamsterman's c... (by Peter1234)
Reading Data into an Array
 
I need to read a large file into arrays but there are different conditions that i need to keep track of. And the file isn't just data there are characters speci...
[1 reply] : Hi! Firstly you should skip the first two line with getline instruc... (by screw)
by kwanlc
std::map segmentation fault
 
Hi, The following code works if I cross-compile it for one of my board using mips-linux-uclibc-g++ but crashes if I cross-compile it for another board using ...
[1 reply] : I am not shure, but you can try to use the following code: static ... (by Denis)
September 2009 Pages: 123... 14
  Archived months: [aug2009] [oct2009]

This is an archived page. To post a new message, go to the current page.