16,001,362 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Harrison H (Top 44 by date)
Harrison H
26-Jul-11 21:18pm
View
Sounds like boost smart pointer
Harrison H
26-Jul-11 21:17pm
View
Perfect. Don't forget to add that including "using namespace x" in the header is a big no no.
Harrison H
22-Jul-11 19:53pm
View
This is the only answer.
Harrison H
14-Jul-11 14:06pm
View
What? Unless he overwrites the copy constructor on that struct, there's no guarantee what's inside of that array on a shallow copy.
Harrison H
14-Jul-11 14:05pm
View
What? Christian, that is a very confusing answer. The short answer is if he wants to return an array he has to allocate it on the heap (via new) and clean it up himself later (via delete).
An even better answer would have him use vectors since he doesn't understand arrays.
Harrison H
14-Jul-11 14:02pm
View
My 5 too. I'd also ask the guy why he doesn't use the damn facilities given to him by C++. He wouldn't have messed this up with better containers, and I bet he doesn't really need the performance "boost" of raw arrays.
Harrison H
14-Jul-11 13:57pm
View
I might add that putting some of this stuff into real classes with member functions, etc... would really help us help you. It was damn hard trying to determine if you have a render loop at all.
Harrison H
14-Jul-11 13:55pm
View
Seriously. Have an infinite loop render the damn thing and then force close it. Then you can worry about adding code that will exit the loop gracefully.
Harrison H
4-Apr-11 11:10am
View
Gr8t stf
Harrison H
24-Mar-11 19:27pm
View
This is very similar to a linked list question posted a couple of weeks ago. Also, it uses the EXACT same codebase (even the "plz" in the question). Where are you guys getting this crappy code to work from? This MUST be a student assignment, but I'd be baffled if the teacher gave you this code to work from.
Harrison H
18-Mar-11 19:02pm
View
Why is that you can't use third party libraries? You're going to have to roll more than just your own socket abstraction for different OSes, you'll also need to take care of threading, and you won't be able to fork on windows...
This just sounds like a bad situation to me. If this isn't some wacky school project, boost is basically your best friend and used in plenty of commercial software.
Harrison H
14-Mar-11 12:54pm
View
Pretty much all in there.
Harrison H
11-Mar-11 18:03pm
View
Hahaha. Awesome!
Harrison H
10-Mar-11 19:23pm
View
Ok.
I see double *angle;
I see you call setAngle with a double pointer. I don't see you mention that the OP needs to new the pointer the double pointer points to. Perhaps you meant to imply that, but just taking your parameter change and dunking it into the OPs code is a no go unless he news it there, which is just bad practice anyway. Either way, since he's asking such a basic question, its obvious you should have pointed it out.
No argument there.
Harrison H
10-Mar-11 14:10pm
View
Actually sorry about that. I forgot that we use openAL for audio abstraction. Ogg vorbis just provided us with the "raw bits" I was talking about. If the OP's still interested, I'd look into one of the simpler solutions like FMOD.
Harrison H
10-Mar-11 13:21pm
View
Yea it can. You just have to be able to load in the raw audio bits. It's pretty versatile. We use it for our cross-platform development framework (ios, android, OSX, Windows, Linux) and openGL for our cross-platform graphics. It's pretty friggin sweet!
Harrison H
10-Mar-11 13:12pm
View
Ok. Well if you need it simpler than that, try FMOD.
Look here for an example:
http://stackoverflow.com/questions/428884/how-to-play-mp3-files-in-c
Edit:
And here for the source:
http://www.fmod.org/index.php/download
Harrison H
10-Mar-11 13:09pm
View
If you go that route, you'll set some garbage space in memory to whatever setAngle tells it too. You're assigning the angle value to an unitialized pointer. Bad Bad.
Harrison H
7-Mar-11 17:41pm
View
I don't think your question is very clear. Are you saying you want to be able to pass in say a file location and then store in your new system?
At the least you'll need to remember what type of file it was originally, so you can restore it to it's original state.
Harrison H
3-Mar-11 14:52pm
View
I'm surprised it's even compiling with the line "#include using namespace std;". Even so, is it even printing your first line of output? If it isn't, something else is amiss, because you don't even call on any of your functions before the first call to std::cout <<.
Harrison H
3-Mar-11 14:48pm
View
I have the same fear
Harrison H
3-Mar-11 14:45pm
View
You got my 5. If he really is talking about comma separated files and even mentioning 3rd party libraries is pretty crazy
Harrison H
1-Mar-11 18:19pm
View
OpenXML seems to suggest that that library is open source.
Harrison H
1-Mar-11 18:07pm
View
Don't forget, if you're using a cross platform framework, write cross-platform code!
Chage "C:\\Sample.txt" to "C:/Sample.txt" !
Harrison H
1-Mar-11 18:04pm
View
I'd give you more than five for the sheer effort you've put into resolving the OP's problem.
Harrison H
1-Mar-11 17:57pm
View
Haha my five
Harrison H
1-Mar-11 17:56pm
View
Oliver's right. Deleting the elements in the list won't change the size. Also, the OP was calling getCount() outside of the loop (maybe he reposted?). The real problem is he's deleting the same pointer twice.
Harrison H
18-Feb-11 16:12pm
View
Both of you got my 5, but note that linked list isn't only for fragmented data in memory.
It's always important to remember what one data structure benefits over another. A std::vector is guaranteed, like you said, to have contiguous memory, but that also means adding into the middle of it takes a high penalty.
Linked lists don't have contiguous memory, but it excels at adding/deleting a reference.
Harrison H
18-Feb-11 10:11am
View
Are you asking how to use a FILE* in the wrapper class QFile?
Google "Class Name 4.7" and you'll get their latest documentation. For example, this is what I get.
http://doc.qt.nokia.com/4.7-snapshot/qfile.html
Looking in that document it is very clear how to use the class.
Harrison H
16-Feb-11 19:02pm
View
I disagree that dynamic memory is at the core of C++. In fact, you can go quite far without needing such things. I find that dynamic memory is more a question of performance (do I want to be copying around the data).
I'm just saying, this is NOT a situation that calls for dynamic memory. I'd say that would be a case of premature optimization.
But you are right, eventually he will have to learn. I just don't think the OP is anywhere near ready for that.
Edit: If ever you're having a hard time with heap data, get familiar with boost::smart pointers. They'll save your life on larger projects that go beyond the scope of reading in some lines.
Harrison H
16-Feb-11 18:56pm
View
The reason is since the data is const, it isn't dynamic, therefore the compiler KNOWS the size of the memory and doesn't have to dynamically allocate it. Doesn't have to do with computational complexity.
Edit: If the memory allocated isn't dynamic, it is on the stack. Otherwise it is on the heap. This is not a rare scenario, it's just literally the same thing as saying "I have a char array of size 100".
Harrison H
16-Feb-11 18:50pm
View
Wow man. Take my 5
Harrison H
13-Feb-11 16:06pm
View
Good link, to your article no less! My 5
Harrison H
13-Feb-11 16:04pm
View
There's no need to introduce the concept of allocated memory to the OP. He needs much simpler functionality than that. Show him how to use vectors and save his life until he needs to know of such things.
Harrison H
13-Feb-11 16:02pm
View
This is the kind of discourse the OP needed. My 5
Harrison H
13-Feb-11 16:00pm
View
I gave you a five, because you are of course sir, correct. But doesn't his code show that he's missing some of the fundamentals of programming? I think a discourse on WHY his program is so jacked up would be beneficial to the OP.
Harrison H
11-Feb-11 11:55am
View
For ALL! Me and my buddy have a framework that builds on iPhone, Android, Mac, PC, and Linux. Mind you it takes a lot to abstract everything away, but it's been friggin sweet.
Harrison H
8-Feb-11 12:53pm
View
Haha. You know, like the linux manual page where you can look up function defintions.
Harrison H
1-Feb-11 18:01pm
View
OMG dude I accidentally gave you a 1 when I meant to give you a 5!
Edit: alright looks like it let me fix it.
Harrison H
26-Jan-11 16:41pm
View
Why do you use a template parameter when the pointer can just be of type shape?
Harrison H
26-Jan-11 16:37pm
View
Gotta say that OGL is the way to go for cross-platform graphics.
Harrison H
23-Dec-10 14:27pm
View
I've heard of schemes that are supposedly pretty portable (running on multiple, multiple, mobile platforms) that use two boolean values (and obviously no assembly)
Harrison H
26-Oct-10 15:43pm
View
Deleted
Reason for my vote of 5
Very neat!
Harrison H
26-Oct-10 15:42pm
View
Deleted
Reason for my vote of 2
2 For the effort, but Tom, that code is awful. Despite the syntax errors and a few logic bugs, you aren't handling a==0 at all.
Show More