1,288 Posted Topics
Re: If you run this under a debugger, it'll tell you which line of code is causing the crash. | |
Re: Read this and do the one appropriate for Win or *nix, depending on what you're coding for. [url]http://doc.qt.nokia.com/latest/qcoreapplication.html#arguments[/url] The arguments are taken from the arguments you pass to the main function when you start the programme. What command line arguments are you passing in to main? | |
Re: Well if you're not coding in C++, you've perhaps not picked the best forum on which to ask questions. :) | |
Re: Is he running the code from the command line by typing it in, or by double-clicking it in some kind of file browser? | |
Re: Can we see the line that causes the errors, and a few lines either side of them? | |
Re: monthSum and monthAverage have a length of some size 'month' They start at monthSum[0] and go all the way to monthSum[month-1]. If you write something to monthSum[month], you will be writing off the end of the array (which lives on the stack) and over something else that is on the … | |
Re: [CODE]void Car::get_gas()[/CODE] While I'm here, take a close look at how you are calculating the fuel_level. | |
Re: [CODE]contact[20][/CODE] is off the end of your array. The last element of your array is contact[19] [CODE]p=&cse2[10];[/CODE] is off the end of your array. The last element of cse2 is cse2[9] You need to read up on arrays and also the scanf function. | |
Re: That bit that says [QUOTE]previous definition of 'class player'[/QUOTE] will tell you where you already defined it. If you look at that, you'll be able to see where you defined it already. Sounds obvious, I know. | |
Re: So many times... [url]http://www.daniweb.com/forums/search14273177.html[/url] | |
Re: On the other hand, why not learn a language that lends itself to a different way of programming? I suspect that if you go straight into Java from C++, you'll learn the different syntax but ultimately it won't do much to make you a better problem-solver. If you were to … | |
Re: Pick out your chosen build environment and make sure you get the tools you need. Do not, I repeat do not, install Dev-C++. I often recommend a simple text editor and manual command-line compilation tools (gcc springs to mind), but this is something of a niche opinion :) | |
Re: If you want array to store pointers, you'll have to make it an array of pointers: array = new int* [s]; array will be pointer to an int pointer, like this: int** array; When you set the size in your code, if the size has already been set, you will … | |
Re: Are you sure that every member function has a definition (not just a declaration)? | |
Re: You are attempting to fiddle around with memory that does not belong to your programme. Make sure that all the memory from PixelBuffer to PixelBuffer+PixelBufferSize and ucBuffer to ucBuffer+PixelBufferSize belongs to you. | |
![]() | |
Re: Connect to ftp server: sftp [email][email protected][/email] Enter password, then use 'ls' to list directory contents, 'cd' to change directory, 'get filename' to download a file, 'put filename' to upload. Check your ftp programme's documentation to ensure you upload and download in binary format, rather than treating the data as text. | |
Re: I haven't read your example code as I'm in a rush, but if you ever have a char array, and you want to carry out string operations on it, you can turn it into a string, carry out your operations, and then turn it back to a char array. [CODE]#include … | |
Re: This error would imply that your compiler cannot locate the file known as countertype.h Is the compiler looking in the right place for it, and have you definitely called it countertype.h ? As an aside, I note that your second file there, which I imagine to be countertype.h, contains a … | |
Re: Or you can explicitly make pointers and pass those by value. [CODE] char* a; char* b; int* c; method(a, b, c);[/CODE] | |
Re: Firstly, be aware that the appropriate time to use exceptions is a matter of opinion, and if you ask five people, you'll get back more than five different opinions :) All the following, thus, is my opinion. To my mind, the clue is in the name; exceptions are for exceptional … | |
Re: It depends on the sensor you are using. Some microphones measure pressure, some measure rate of change of pressure, some measure others things. | |
Re: I'm something of a fan of the easyBMP library. Here's some incomplete pseudo-code that should demonstrate the ease of fiddling with bmp images using it. [CODE] #include "EasyBMP.h BMP theBMPImage; theBMPImage.ReadFromFile("somefile.bmp"); width = theBMPImage.TellWidth(); height = theBMPImage.TellHeight(); // Over all pixels, using height and width in a loop.. // Readpixel … | |
![]() | Re: Linking errors means that the code you've written makes sense, but when the linker goes looking for some functions you have promised to provide (usually in a header file), it can't find them in a compiled form. These functions look like the default constructors for CPerson, CCustomer, CStaff and CGame. ![]() |
Re: On lines 10 and 11, you create two variables; an int and a char. You then, on line 32, concatenate them with a std::string. This is where the problem is. If you made those two variables std::string as well, you'd get the seat output on line 33. Alternatively, leave them … | |
Re: If you include windows.h, you can use the MessageBox [url]http://msdn.microsoft.com/en-us/library/ms645505(v=vs.85).aspx[/url] | |
Re: For those of you who like newlines in your code, I present the following: [CODE] class X { int data_; void f() { //shall I cache var data_? by doing int cached = data_ //and instead of this: if (data_ >= 0 && data_ < 1000 || data_ < 0 … | |
Re: As Fbody made clear, that object will only die when you hit it with delete, and the reference IS the object - not a copy of it, not a pointer to it. If you replace myfunc with the following, you'll see that the object dies as soon as it goes … | |
Re: A "class" is a kind of C++ object that you can define and then create. If you need to include one, I suggest you read up on what classes are, and then write one. [url]http://www.cplusplus.com/doc/tutorial/classes/[/url] | |
Re: What's the actual error message(s) from the compiler? I note that you're using new and feeding it Seat("A1", true), which seems a bit wrong as new has no such prototype; [url]http://www.cplusplus.com/reference/std/new/operator%20new/[/url] What happens if you abandon using new and just try this, within your actual main function? [CODE] Seat A1 … | |
Re: Since you're just looking for a tip to get you started, here's a clue to look up: "pointer arithmetic". | |
Re: ACE_CString s1 ("hello"); ACE_CString s2 ("world"); s1+=s2; | |
Re: C++ knows nothing of colours. C++ knows nothing of your screen. To alter colours on the screen, you will have to go looking for information on the C++ libraries provided with your operating system, which are available to you through the API. | |
Re: I note you have put [code]using namespace std;[/code] at the top of your header file. This is considered bad form; anyone who ever includes a header file with this at the top of it will have their namespace polluted with no warning whatsoever. As an aside, it looks like you … | |
Re: C++ 98 does not accept variable sized arrays. You must define the size of an array at compile time. If you cannot know the size at compile time, you will have to allocate memory yourself, or alternatively use one of the C++ STL container classes. | |
Re: Bumping a year old addendum to a four year old thread? If you have a question, start a new thread :) | |
With much pleasure I've started using a TR1 imlpementation. I'm a bit wobbly with it, but I'd dearly like to replace some code involving old-school pointers with some shared_ptr The original code is as follows below. It creates an array int* of size rows, each of which points to an … |
The End.