General C++ Programming - June 2010 (Page 11)

keeping track of time in a sound file
 
How do you keep track of time in a sound file? I'm creating a class that will mark down in an array the key I press and the time I press it in relation to th...
[no replies]
some questions about exceptions
 
* is that ever possible to throw and catch without a single copying of what's thrown? Example? * why not throw from a copy constructor? And from operator=?
[4 replies] Last: I've always thought the anonymous Copyable would get destroyed when yo... (by closed account 1yR4jE8b)
How do I clear a textfile in a program
 
Hi guys, I need to clear a textfile after I click a button instead of deleting it. I found a few codes online but I can't seem to get them to work. I need to...
[3 replies] Last: If you want to ensure deletion of the contents, open the file with the... (by Incubbus)
CONSTRUCTOR CALLS...
 
In this code: Class X{ public: X() { cout<<"Constructor\n"; } ~X() { cout<<"Destructor\n"; } X(const X&){ cout<<"Copy Constructor\n"; } }; ...
[3 replies] Last: I was thinking if it's sane to rely on such behaviour or not. As for m... (by KarlisRepsons)
how to use boost lib property tree to get children name
 
Hi I have read the 5 min tutorial that provided by boost.org but i have no idea of how to get the children' names. For example given that there is an X...
[no replies]
by JFloyd
Lattice Number Generator
 
I had the idea today of a "lattice" number generator. The concept of it is this: 1) User inputs how many rows they want 2) User inputs how long they want t...
[1 reply] : I thought of a way to do it with arrays where it creates as many slots... (by JFloyd)
by donnyb
Memory leaks
 
I have done my homework on this subject. Here is the deal. I run valgrind (a memory checker for my program) and it says that there is no leaks. However after m...
[6 replies] Last: Found the leak. I wrote two functions that malloc the data only once,... (by donnyb)
by DeucEy
Char String Won't Recognize
 
Im trying to make a 'make your own bug' program sort to speak, and One of my members in the class Bug is called bugName where I am trying to let the user create...
[2 replies] Last: I like the way you illustrated that lol. That takes care of that prob... (by DeucEy)
sizeof string pointer
 
Hi , I have a class in which i have a private variable as private: static const int size = 100; const string* stack ; now in the constructor of the ...
[8 replies] Last: Never mind. memset() and memcpy() only make a difference when dealing ... (by helios)
multimap find with inconsistent order
 
Hi, I've got a situation where I'm trying to find a range of keys that equal, but the sorted nature of multimap isn't applicable to my data types. For example,...
[8 replies] Last: Well, the N's are supposed to represent wild-card character values. So... (by smcguffee)
rotating a 2d vector in directx
 
I'm making a 2d game in directx and need a function to rotate a 2d vector(D3DXVECTOR2). There are directx functions for rotating 3d vectors but I couldnt find a...
[1 reply] : I am learning direct3D 9 now for the same purpose (writing 2D games)!... (by closed account D80DSL3A)
iterating objects
 
What is it called when you iterate objects? ex: class snake { public: void setAge(int a) {_age=a;} int getLength(); private: int _age; } int snake...
[8 replies] Last: You can't output the literal names "mary", "joe" and "betty" unless yo... (by Galik)
Your favourite C++ undefined behaviours? (1,2)
 
For me the first thing to come in mind is the uncertain expression evaluation order, for example: Edit: worse than ev. order. i = 0; j = i++ + ++i; So t...
[35 replies] Last: Recursively re-entering a function during the initialization of its s... (by helios)
mandatory pre-declaration of friend function?
 
This works well on GCC despite "The C++ Programming Language 3rd ed." p 280 appears to say it can't: #include <iostream> namespace test { class X ...
[4 replies] Last: As far as I can tell the Standard C++03 says it is legal unless your c... (by Galik)
2D-Array with Polymorphy
 
I wanna create a field for a little game. The field consists of the followed classes: Floor Wall Door All 3 of them are derived classes of the abstract ...
[6 replies] Last: I'm working on something very similar, so I think I could help you ... (by closed account 1yR4jE8b)
Move a mouse to a point on a screen?
 
I wanna know if its possible to move a mouse to a certain point on the screen. I looked at the post at http://www.cplusplus.com/forum/beginner/1258/ and tried t...
[1 reply] : The console cursor and the mouse cursor are two different things. To w... (by Duthomhas)
Inputting 0101 and store as 101
 
Is there any way to do that? For example, the user input 0101 to the program and the program stores the value as 101 in integer type. I tried this: int va...
[2 replies] Last: When you cin >> somenumber then leading zeros are discounted. How... (by Duthomhas)
Is this pointer code?
 
Hi guys, New to C++ so if my question is really stupid, please forgive me static void metadata(Meta* m) { virtual void compute (int count, float** in...
[10 replies] Last: cool, that clears up my confusion thanks a bunch guys (by bubbleboys)
IOStream and STL
 
So recently, I ran into an error while writing a program of mine, and it was a curious little error indeed. Basically, I had a deque of objects that used ifs...
[3 replies] Last: maybe you need to catch the exception properly... try { ... (by bigearsbilly)
by Null
extern + functions
 
Why does this code compile? extern void msg() // ! { std::cout <<"msg"; } int main() { msg(); } I thought that extern specifies that f...
[14 replies] Last: It is no wonder that everyone is confused with all the misuse of terms... (by closed account z05DSL3A)
June 2010 Pages: 1... 910111213... 18
  Archived months: [may2010] [jul2010]

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