That actually makes sense, thanks for the explanation. It works great now.
Type: Posts; User: rozner
That actually makes sense, thanks for the explanation. It works great now.
Hi,
This one's not so important but, nice to have. I've been playing with the operator overloading for some simple classes and it's quite nice. I found some examples of overloading << which don't...
hmm... this looks interesting. I may give that one a try. I wish I had more time to work on this... at least I'm learning more C++ :) I had the option to do this assignment in Java but I wanted to...
well, you're right, my Java example was more along the lines of how you can compare anything to null (except for the primitives). But here's another question which my resolve this issue altogether....
Hi,
I'm doing some stuff with iterators in my code. I occasionally run into problems with a global iterator being set in one place and used somewhere else. Most of the time it works properly, but...
Hello,
I am working on a school assignment and have one small problem. Here's the general description of the assignment:
Create an openGL program (2D) that can be used to be a street map of a...
ok, so it turns out it had nothing to do with the vector code above. Using the debugger properly as you suggested I was able to see exactly where it was screwing up. Thanks.
that was my thinking, that the break would avoid this problem, and to be more clear, this is a runtime problem, it compiles fine.
I haven't tested your suggestion yet, I'm not sure if it will...
hi,
I'm having some trouble with a vector. I'm at a point where I need to remove and object from the vector and I inconsistently receive the error:
"vector iterator not dereferencable"
...
I have several different objects (2 for now, but maybe more later), that are basically Rectangles but have certain differences (hence the subclasses). I don't really see how this is a design error,...
Hi,
I'm having an issue trying to pass a vector to a function.
The function parameter is of vector<base_class>, then I'm actually passing vector<sub_class>, but it doesn't work.
Is it...
interesting, I like the last suggestion, I think I may try that,
Thanks for the input
Hi,
I've been working with Java for a while and had minimal c++ experience before, although a lot of c experience. So most of the problems I'm running into have to do with the way c++ handles...
thanks, it actually works fine with fprintf after removing the \n
I will try with fputs as well
Hi,
I have been learning about pipes in C recently. Here is an example of some code that works fine:
// some lines are omitted
switch(fork()) {
case -1:
well, thanks for all the input on this one, I guess I'll try the GOTO, it'll be first for me in C.
well...from what I've heard and read about GOTO, and the fact that you call it EVIL, I'll probably stay away from it. Thanks anyways.
Hi,
I would like to know if it is possible to break a loop from inside another loop. In Java this is possible like so:
myloop:
for(; ; )
for(; ; )
thanks alot, I will make some modifications
Hi,
I am trying to overload << as a friend class. As far as I understand, if class "a" declares "friend class b" then class b should be able to access all private and public members of class a, if...
thanks, but I kind of figured out an alternative solution. I was freeing the memory every time I add a new customer. So I moved that into a new function that will free the memory when you quit the...
I have this program that almost works. I have a typedef struct called Customer with several fields. Two of them are char* which will be to store strings. I have an array of Customer, but whenever I...
Hi, I actually have two questions about this code. One is in the subject line. I want to basically read in a string and make sure it is an integer which works fine. But then I want to cast it to int...
Thanks a lot. This helps. I do apologize for asking easy questions, but I just started coding C a week ago. Vber, you were right about that fprint as well. Salem, I originally had fflush(fp) but I...
I know a string is just an array of chars, but how can I make an array of strings?
#include <stdio.h>
#define length 80
void main(void) {
FILE *fp;
int ch;