Thanks guys. I knew that if you wanted to change variables you could always do a pass by reference. I didn't realize there was a comparable situation for pointers :)
Type: Posts; User: maxsthekat
Thanks guys. I knew that if you wanted to change variables you could always do a pass by reference. I didn't realize there was a comparable situation for pointers :)
Great. It doesn't work. I fully understand that. I even understand it's not the proper way of doing this. I still don't see what is the "proper" way of doing it.
Let me break down the problem for...
No, I'm not new to pointers. This is actually a much simpler version of what I'm doing... In another program, I have a function which needs to create a 2D array, a single array, and perform some...
Hi guys,
In the code below, the new keyword creates 5 integers for a pointer. However, whenever I am outside of the createmem() function, I cannot access this memory-- visual studio says that...
Works great. Thanks guys :)
Hi guys,
I'm having trouble getting a namespace to work from within a class definition. I'm not entirely sure this is possible, but the ultimate goal is to create an object and pass it one of the...
Madre de Dios!
...
Note to self: "|" != "||"...
The line "ifstream myfile("STLBox.stl". ios::in || ios::binary);" had an extra "|". So, it was opening in character mode. Doing it correctly,...
Read takes a character pointer, not an unsigned character pointer. So to do it that way, I tried:
#include <fstream>
#include <iostream>
#include <cstdlib>
using namespace std;
Sorry, that's just in there from earlier testing... I looked at the character array in the watchlist of Visual Studio, and it only contains default (garbage) characters after the 15 bytes (chars) of...
Hi guys,
I'm trying to read in a file in binary mode. The file is 684 bytes. If you look at it under a hex editor, you'll notice that there are 15 bytes of all zeros starting around the 85th byte....
Aha! Found it!
For anyone interested in destructor precedence, here's a couple of great links:
[11] Destructors, C++ FAQ Lite
Why is destructor called twice? - C++
The second one is...
classnames is just used for setting the name of each individual course within the classLists array (which is made up of singlyLinkedList objects, which contain my linked list). I don't destroy...
registrations.txt will have to be renamed to registrations.dat in order to work correctly
Hi all!
I have a destructor implemented below. The problem is, it seems as if it deletes all of the items in the list properly but when the program gets to the final line of code, which is just...
Eureaka!
Thanks for the help, guys! I read the link, then wrote a copy constructor (then noticed the program already had one-- still, was good practice...) and did as you said for returning by...
bithub,
Thanks for the reply! :)
Here's what I ran into when I did that: the first object (this) is now altered by the operation (which makes it a +=, instead of a + operator) say you have code...
I thought I did that with the snippet, although the snippet will not compile by itself... Here is the full:
PtrandRef.h
#include <iostream>
using namespace std;
laserlight,
I would love to use a vector, but this little snippet is part of a course I'm taking (universities love to reinvent the wheel for assignments ;)
What I can't seem to figure out is...
If I have an class with a dynamically allocated array inside of it, how can I return an object from an overloaded addition operator?
The class is basically:
class foo
{
foo& operator +...
I know this is a C++ board, but I think XNA (which uses C#) is an easy to pick up beginners intro to game development. It's mostly just a wrapper for the DirectX stuff, so if you get familiar with...
Whenever I try to compile a project in g++, I get the following errors (below). I have several other files for this, but I'm refraining from posting all of them to spare monitor-induced headache :)
...
Hmmm....
Seems to work, which is weird, because I tried that earlier. Maybe I'm just having a case of the Fridays :P
Thanks again! If I can ever be of assistance to anyone on this board, please...
Hi all!
Sorry for so many questions. If you feel that I'm abusing this board, please say so, and I'll go elsewhere... I typically consult google, cplusplus.com, codeguru, my books, search the...
Thanks for the tips!
It's always the simple things in life, eh? ;)
I had tried the include guards as a last-ditch effort. Thanks for the explanation :) It's amazing what changing .cpp to .h in...
Hi all!
I have a class that is distributed between its definition (popClass.h) and its implementation (popClass.cpp). However, when I go to compile this collection, I get a LNK2005 error (all...