278 Posted Topics
Re: You first loop through i, and inside this for loop you loop through j. So the sequence will look like: i j output 0 0 "5a" 0 1 "5b" 0 2 "5c" 1 0 "5a" 1 1 "5b" 1 2 "5c" 2 0 "2a" 2 1 "2b" 2 2 "2c" … | |
Re: Or look up the *_cast statements in C++. e.g. static_cast | |
Re: It does make sense, but your question is way too general. Based on you're post we have no idea how far you are... have you actually downloaded the information from the website already? Have you parsed it to get the individual items that you are interested in? etc. etc. So … | |
Re: Are you sure this 'Chilkat' FTP library throws exceptions when something goes wrong? Maybe it is expecting you to check the return value of WriteFile etc. | |
Re: Probably because you didn't specify the namespace. nth_element is an std function so is only defined in the std namespace. U have some options: - Use std::nth_element - Put using std::nth_element; after including the header file - Put using namespace std; after including the header file (not a very sexy … | |
Re: There is a new 'type' of framework, called the .net Framework 4 Client .. something. It's much smaller because it doesn't include the server-side stuff that a client doesnt really need anyway. You can try to install this to see if it will work. I'm no .net developer so I … | |
Re: Why would you want to keep the console application seperate? There aren't (m)any real world applications that spawn a new process to do some work and only use the GUI for configuration. So just create one GUI project, and put the code from the console application in there... You will … | |
Re: @Chris : That's not really a C++ problem, a programmer should not use a reference to change a variable in a function, if the variable is to be changed he should use a pointer. A reference can be used to 'speed up' functions that take large data structures as arguments, … | |
Re: vc_attributes is part of some CodeAnalysis 'framework' by Microsoft( [url]http://msdn.microsoft.com/en-us/library/ms182036(VS.90).aspx[/url] ). Are you using someone else's code or a 3rd party library ? Or is it your intention to use this source code analysis/annotation ? I develop for Linux and Windows so I use Code::Blocks (there is a new version … | |
Re: A class that has _any_ pure virtual function cannot be instantiated directly. So not only complete Abstract classes... [code=cpp] class myBase { virtual void pureVirtual() = 0; void normal() { }; }; class myClass : public myBase { void pureVirtual() { } }; int main() { myBase base(); // Error, … | |
Re: What your teacher said is true to some extent, a lot of programming techniques are applicable to multiple languages. This does not mean that every language is equally easy to learn. C and C++ are lower languages than languages like VB, java etc. generally this also means that are harder … | |
Re: Ok first of all: Why are you passing this list as pointer and not a const&? You are not modifying the passed list in any way... If you insist on using a pointer to pass it, we need to see how you're calling this function to be able to see … | |
Re: First of all, use code tags to paste code... So let's look at your error, it is complaining that it cannot convert an int* to an int. And the error occurs in getValue. getValue is declared to return an 'int', and in the function you return 'value' which is declared … | |
Re: Any compiler will tell you that's wrong. When you allocate an array statically(as oppose to dynamically) the size of the array _must_ be available at compile time. In your example, maxElements is a variable so the compiler has no idea if it's going to change at runtime. So you have … | |
Re: Read this: [url]http://www.daniweb.com/forums/thread296671.html[/url] | |
Re: VisualStudio has a free edition (called the Express edition). It has some downsides though if you plan to release your programs to the public(requires microsoft c++ redistributables to be installed on the target system, but it mostly is already). I've used VS when I started, but have since moved to … | |
![]() | Re: It's not outputting the address of the values.. an address looks like 0x00401000 and the individual elements of the string wouldn't just take 1 byte (and also.. '88' doesn't really follow 57 :P). Basically, you have stumbled upon something called 'implicit conversion'. When you access isbn[ i ] the datatype … ![]() |
Re: Are you maybe executing a release build outside of VS, and inside a debug build? In that case there could be an assertation in the function. The documentation does not state that the handle must be valid... it does state that if the handle is closed while the wait is … | |
Re: CNoFila is a class... and you are comparing it with operator !=. But how can it compare your class with NULL? This comparison only makes sense if you implement operator!= for you CNoFila(Google for 'Operator Overloading') or if 'Actual' is a pointer to CNoFila (a pointer can be NULL). | |
Re: How do you think it should be done? What have you tried yourself? Just saying it is difficult for you gives us no indication what you're having trouble with understanding. | |
Re: The question is to assign a char, to an int variable. Meaning you will need to declare an int: [code=cpp] int myInt; [/code] And then assign a char to it: [code=cpp] myInt = 'c'; // or: char myChar = 'c'; myInt = myChar; [/code] The point of this assignment is … | |
Re: As far as I can tell, in "(a14*pow(temp,(12-14))" the ( is unclosed. It's on the 5th line in your big calculation. It would help if you format this big calculation a little.. it doesn't matter if there are spaces or tabs around math operations... that way it would be much … | |
Re: I assume you are re-opening the same file because you first want to create it and then edit the existing file. There would be no problem if you don't re-open the file and just to seekp and put(c). What you want is of course possible with fstream, it would be … | |
Re: Before expecting any comments from us, please show us what you have done yourself. Did you think about it atall? If yes.. what are your thoughts? If no... think about it first. | |
Re: Hmm, your method to search for the next 'available' pointer-'spot' is not very efficient. You are using C-style arrays... which is no necessarily wrong but what you're trying to do is much easier by using C++ vector's. You won't need the 'instanceExists' array then: [code=cpp] #include <vector> using std::vector; vector<baseObject*> … | |
Re: [QUOTE] In all the programs that we have made, all the headers(#include <iostream>...etc) are in the top of the cpp file in the source folder.[I] Why is there a folder that is named header files then?[/I] [/QUOTE] Header files define prototypes of functions that are implemented either in a library … | |
Re: You can place the entire (nameless)struct's declaration in the class header. e.g.: [code=cpp] class myWrapper { struct { int houseNumber; } address; public: myWrapper() { address.houseNumber = 555; } // this is valid }; int main { No way to access address from here, apart from a public interface. } … | |
Re: Can I ask why you want to use dynamic memory allocation in this case? Rather than just using 'bool hasSetPages;' and forget about new/delete; | |
Re: So it does not say that it cannot find libboost_regex.so? In that case: does /usr/lib contain any other boost libraries? If I remember right.. (I've used this library a while ago) the regex lib depends on some other boost libraries that you need to link to aswell. Maybe post the … | |
Re: I've had the same 'problem' as you when I started (I'm also selftaught)... but I don't really understand what error handling has to do with it... but let me comment on that first: You created your own macro that in debug-mode prints some information about the error.. this is a … | |
Re: If this is something that you commonly 'mess up', consider writing code like: if( true == myBoolean ) instead of if( myBoolean == true ). If in the first case you write if( true = myBoolean ) by accident, the compiler will start complaining (the same works with other conditional … | |
Re: If I remember the C++ programming language book correctly the standard states that the second expression should not be evaluated if the first evaluates to false(would be pointless)... but maybe the OP's compiler doesn't follow this standard strictly.. or I am remembering wrong and it's not actually in the standard. … | |
Re: There are left over characters in the buffer after the first cin.getline(), the second cin.getline() is picking this up. Read this: [url]http://www.daniweb.com/forums/thread90228.html[/url] | |
Re: [code=cpp] void Map::LoadMap(const std::string& filename) { std::ifstream file; if(!file.is_open()) { [/code] is_open() will _always_ return false, no matter what 'filename' you hand over to this LoadMap function. Think about what you're missing, how will ifstream 'know' which file to open? | |
Re: Post the header file you're including (if it's small) and how you include it... Could be a missing #endif, or a missing ; etc. | |
Re: The [out,retval] looks like an annotation to me, but I have never seen it this way. What compiler do you use? If it is an annotation it is basically an aid for the compiler, or some code verification tool. For instance if you as programmer are to delete the returned … | |
Re: We'll need more information than this... generally ReadProcessMemory should not crash the target application of course, so it seems you're doing something 'wrong'... without knowing what exactly you're doing we're in the dark here ;). Try to down-size the code as much as possible while still crashing the target (e.g. … | |
Re: Read this: [url]http://www.daniweb.com/forums/thread90228.html[/url] | |
Re: Let me get this straight.. the code you are currently posting (with the temp stringstream) is working, but if you write [code=cpp] arq_linha_part >> parm; [/code] It gives you an error? If so, then it should give you an error. The short answer is that std::string (the arq_linha_part variable) does … | |
Re: I don't remember exactly, but some years ago I tried the same, and it was a downright pain in the ass to get it to work, so in the end I just went back to the microsoft C++ compiler... it will save you a lot of trouble. In any case … | |
Re: It compiles fine here... can you copy/paste exactly what it says? | |
Re: It is impossible to say how much faster your code wil run, if any faster atall, if you 'use vectors or pointers'. Generally using vectors will even be slower than using raw pointers. I'm not sure how you expect to see a performance increase by using pointers... in certain areas … | |
Re: [url]http://en.wikipedia.org/wiki/Reference_(C%2B%2B[/url]) took 2 seconds to find | |
Re: No, Banfa is right. You are correct that the first element is located at index '0', and you know that there are in total 5 elements. 0 - first element 1 - second 2 - third 3 - fourth 4 - fifth (bingo, end of array) (5 - sixth, non-existing) | |
Re: It really makes sense what you're doing wrong... I think you basically wrote the code that sents newNode->x and then copy/pasted it, changing 'x' to 'y'. Look at the things that you are doing for _both_ x and y, and think about if it makes sense... Let me state it … | |
Re: The sockets you 'accept' are set to blocking, which means they can wait indefinitely until new data is ready to be recv'd. So if you are only sending 2 strings on that socket, the loop will stick there if there is no data to be read. I'm having trouble understanding … | |
Re: A few things: Why is 'item' in the test class public? In your wrapper class you perform some operations twice: [code=cpp] string top(){ item.top(); return item.top(); } // Why not: string top(){ return item.top(); } [/code] Also, your push takes a string* as arugment, but it is not clear if … | |
Re: Why does it obviously not work if you copy just the executable? You'd mostly only need an installer when releasing a big project... if it's just some executable what would the installer do to make it working on the other's PC? | |
Re: By building the solution, it is already creating the exectutable(check your project settings for 'output directory'. Since you are building with the Express edition of Visual Studio, the 'C++ redistributables' need to be installed on any computer where u wish to run your executable(mostly it is). | |
Re: As far as I can see, you are never calling calcArea(). |
The End.