Type: Posts; User: Paul McKenzie
Search took 0.61 seconds.
December 10th, 2013, 07:34 PM
Well if they're global, then they're are initialized to 0. But that brings up the point of having global variables named "i". That is the absolute worst name to give a global variable.
December 10th, 2013, 07:32 PM
This forum are for questions concerning the Visual C++ compiler, not Borland.
How about debugging the program? I'm sure Borland C++ comes with a debugger.
Also, please clarify "gives me an...
December 10th, 2013, 09:20 AM
The bad news for you is that your "working" program will more than likely have a bug, but that bug is yet to be exposed.
Unlike other languages, just because the program runs on system A doesn't...
December 9th, 2013, 07:46 AM
Did you hit F10 to single step through the program? Or did you hit F5 to run the program without stopping? You should be hitting F10.
Second, take the program that you finally have and run it...
December 6th, 2013, 01:12 PM
Sounds like you should be using a valarray:
December 6th, 2013, 09:49 AM
What have you done to debug your program? Programming is much more than writing and running code. You need to debug your program using the debugger to see where it goes wrong.
December 6th, 2013, 09:46 AM
So why did you post in a Visual C++ forum?
December 4th, 2013, 08:01 PM
Sort of like the questions that Gimpel software would ask when they are promoting their PC-Lint product.
They would ask "The programmer expected x, but y happened. Can you spot the error?". ...
December 4th, 2013, 04:51 PM
What was the question given to you? It couldn't have just been "why does this output 2". If that was the question, then the answer would have been
"It outputs 2 because that is what you coded...
December 4th, 2013, 01:01 PM
Going back to this:
Is this code being performed in some sort of a loop? If so, maybe the issue is not that the result is 54, but that the loop was executed "n" times. If the value of "n"...
December 4th, 2013, 11:32 AM
Everything (if those variables contain valid values) is valid. That's the point -- the error is not in cerr or any of those statements.
Again, cerr is not the error. That is where the program...
December 4th, 2013, 10:38 AM
That answer gives the impression that there is something wrong with cerr, and to move on, blame cerr and use cout instead.
That would be totally false -- the problem isn't with cerr, and just...
December 4th, 2013, 06:02 AM
So maybe the problem is that the "large program" is doing something invalid?
The issue is that you just cannot take a section of code and assume that is where the error originates. In C++,...
December 3rd, 2013, 10:34 PM
Let's start with why you think it should (or shouldn't) output 2. Then when we see your explanation, we will correct it if it isn't correct.
Otherwise, where do we start explaining to you...
December 3rd, 2013, 10:20 PM
I see no program that is runnable. I see some code plucked out of a larger program, where we have no idea what state the program is in when that code is executed, have no idea what type of variables...
November 30th, 2013, 10:11 PM
inputfilestream.open("myfile.pdf", ios::out | ios::binary);
char mychar; //unsigned char gives an error though it can be //converted to unsigned char later.
November 30th, 2013, 10:05 PM
So again, why not read the LZW object's description? It has the length telling you how long the data is. So you position the file pointer to the beginning of that data and call the read() function...
November 30th, 2013, 06:46 PM
I'm really responding to the OP's claim that "nobody uses console programming anymore." That simply isn't true.
November 30th, 2013, 05:44 PM
Many, if not most of the programs you run now are console programs with a GUI wrapper around them. The Visual C++ compiler you're using now is a console program (cl.exe), so is the...
November 30th, 2013, 11:55 AM
A PDF object describes the LZW stream, and this object gives you a length attribute that tells you in bytes the size of the LZW data. So why not just read the number of bytes described by what the...
November 30th, 2013, 11:21 AM
Are you saying there is no library that can decompress a stream that is LZW encoded??Where the data comes from is irrelevant. You have a buffer, it has data, the data gets processed.
November 29th, 2013, 04:44 PM
Because that's how C++ works. If what you wanted could be done, don't you think it would have been done already? If you don't like the fact that the user of the void pointer must know before-hand...
November 29th, 2013, 05:51 AM
Yes. However that code has never been legal for Visual C++, and it has never been legal ANSI C++. Given that the question was posted in the Visual C++ forum, might as well point out that the code...
November 29th, 2013, 05:39 AM
I don' know how that code you posted helps in answering your question.
Given that, the answer is no different than any other type. You include the definitions of the type before you start using...
November 28th, 2013, 06:53 PM
But to do anything that you desire you do have to come up with something similar in design to boost::any. Playing simplistic games with a "dumb" type as a void pointer isn't going to accomplish this...
Click Here to Expand Forum to Full Width