1,174 Posted Topics
Re: Perhaps you might start by looking into [URL="http://msdn.microsoft.com/en-us/library/aa446639(VS.85).aspx"]GetFileSecurity Function[/URL]. And from there on try to figure out the relevant parts of the Windows authorization. | |
Re: [QUOTE=fugnut;1147673]anyone? How do you load in values to a variable?[/QUOTE] If you add the following [ICODE]cout <<[/ICODE] there [code] while( getInput(infile, ID, Sales) ) { cout << "ID:\t" << ID << "\tSales:\t" << Sales << endl; displayResults(outfile, ID, Sales); } [/code] What is the output on your screen? | |
Re: 'this' is always a pointer, so e.g. [ICODE]this.Year[/ICODE] is wrong, it has to be [ICODE]this->Year[/ICODE]. [ICODE]operator <()[/ICODE] is 'const', that means that every class method you call inside it, must also be 'const', in this case it means [ICODE]getMonthInt()[/ICODE]. Then again, you might directly access the [ICODE].Month[/ICODE] member variable. To … | |
Re: Is your code using [ICODE]assert()[/ICODE] or any of the VS macros wrapped around [ICODE]assert()[/ICODE]? Furthermore, have you written e.g. [code] #ifdef _DEBUG .. do something here .. #endif [/code] If you have, then make absolutely sure that you are not changing anything via those pieces of code. | |
Re: [CODE] #include <stdio.h> #include <stdlib.h> int main(){ [COLOR="Red"]char[/COLOR] option, [COLOR="Red"]factor[/COLOR]; printf("Choose your operator: \"+\" ; \"-\" ; \"*\" ; \"/\" \n>\t"); scanf(" %c", &option); printf("You chose : %c \nChoose your factor:\n>\t", option); [COLOR="Red"] scanf[/COLOR]("[COLOR="Red"]%d[/COLOR]",[COLOR="Red"] &factor[/COLOR]); printf("You chose : %i\n",factor); printf(" %c", option); if(option=='+'){ printf("It's WORKING!"); system("pause"); } return 0; } … | |
Re: [QUOTE=Ultratermi;1146086]Hey, can someone tell me where I have to start? I wanna make a program like cheat engine but I have no clue how :o... Im [B]not[/B] a beginner ( but also not an expert :P ) in C++(/CLI)... What functions do I need? etc. :p Thx ;D[/QUOTE] Mmmm, at … | |
Re: Please forget [I]missing library files[/I], as a matter of fact, what do you actually mean by missing library files? The only way that it seems to run succesfully (that is, without crashing), is to have it read an empty input file. [EDIT] What compiler are you using .. - at … | |
Re: Apparently you want to [COLOR="Red"]return a reference[/COLOR], like so [code] friend std::ostream[COLOR="Red"] &[/COLOR] operator<<(std::ostream& os, const u_string& uStr); // and std::ostream [COLOR="Red"]&[/COLOR] operator<<(std::ostream& os, const u_string& uStr) { os<<uStr.str; return os; } [/code] | |
Re: [QUOTE=coachkrzyzewski;1146211]How do I use the STL stack implementation with [I]pointers to my TreeNode class[/I]?[/QUOTE] You had a stack of TreeNode objects, not pointers to such. So .. [CODE] stack<TreeNode * > s; TreeNode * a = new TreeNode(val); s.push(a); [/CODE] | |
Re: Most likely GCC is unable to locate <stdarg.h>, just like <stddef.h> in your other thread. Something is wrong/misconfigured/missing with your setup/environment - that's all I can think of. Have you tried to locate these files on your computer? Try passing the [ICODE]-v[/ICODE] option to GCC so that you get to … | |
Re: In addition to what's been already stated. Only focusing on a very basic thing. This basic thing here is that you try to delete memory that was never allocated in the first place. In other words, you do [ICODE]delete string[/ICODE] without having allocated any memory to [ICODE]string[/ICODE] and [ICODE]string[/ICODE] is … | |
Re: Try specifying the full path to the .ico file, like [code] hIcon = (HICON) LoadImage(NULL, "c:\\full\\path\\to\\menu_two.ico", IMAGE_ICON, 32, 32, LR_LOADFROMFILE);[/code] [ICODE]GetLastError()[/ICODE] gives you an error code that might be helpful when figuring out the reason of a failing Win API call. See an example of [URL="http://msdn.microsoft.com/en-us/library/ms680582(VS.85).aspx"]Retrieving the Last-Error Code[/URL] | |
Re: One thing to note, you have had there a simple out-of-bounds write [code] // 'n + 1' elements -> last valid index is 'n', not n + 1 double * coeff = new double[ n + 1 ]; for(int i= [COLOR="Red"]n + 1[/COLOR] ;i>=0;i--) // here it would go wrong … | |
Re: [QUOTE=XinJiki;1143322]I need help with reading each letter at a time[/QUOTE] To access each character of a std::string one at the time, you can use the [ICODE]operator [][/ICODE] [code] string s = "abcdefg"; for(size_t ii = 0; ii < s.length(); ++ii) { cout << "s[ii]: " << s[ii] << endl; } … | |
Re: See .. [URL="http://www.parashift.com/c++-faq-lite/templates.html#faq-35.18"]Why am I getting errors when my template-derived-class uses a nested type it inherits from its template-base-class?[/URL] | |
Re: One small/solid example that probably is what you are after is [URL="http://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=registerhotkey&ReleaseId=1833"]Using RegisterHotKey with MOD_NOREPEAT[/URL] Depending on your compiler/SDK, it might be that you are unable to use the [ICODE]MOD_NOREPEAT[/ICODE] flag, in which case, just don't use that flag anywhere. | |
Re: >> If I use Entry *Index[100]; Assuming the destructor still looks like [code] Dictionnaire::~Dictionnaire(){ for(int i = 0; i < indiceCourant; i++){ delete Index[i]; } [COLOR="Red"]delete [] Index[/COLOR]; } [/code] [ICODE]delete [][/ICODE] is guaranteed not to work, so rather use [ICODE]Entry ** Index[/ICODE] or otherwise remove [ICODE]delete [] Index[/ICODE] altogether. … | |
Re: [QUOTE=alma27534;1143091] ?Invalid number of arguments Press any key to continue . . . [CODE] int main(int argc, char **argv) { if (argc != 3) { printf("?Invalid number of arguments\n"); system("pause"); exit(1); } }[/CODE][/QUOTE] Well, it is expecting to be run with 2 arguments, if those arguments are not present on … | |
Re: [QUOTE=KRal;1144336]The compiler will not allow access. I know I am overlooking something.[/QUOTE] You have to pay attention to the method signatures. The class declaration has [code] // returns a reference to a Fraction, and takes in a reference // to Fraction friend Fraction [COLOR="Red"]&[/COLOR] operator + (Fraction [COLOR="Red"]&[/COLOR] c); [/code] … | |
Re: The if-statements there are fundamentally plain wrong. If you write .. [code] if (ValueRead == 'A' || 'a') [/code] that evaluates to [code] if (ValueRead == 'A' || true) [/code] which is always true -> [ICODE]counter[/ICODE] is incremented. So, you want to write the if-statements like .. [code] if (ValueRead … | |
Re: One thing to check, are you absolutely sure that the NodeItem.cpp is included in the compilation? Have you taken a look at C++ FAQ [URL="http://www.parashift.com/c++-faq-lite/strange-inheritance.html#faq-23.10"]What does it mean that the "virtual table" is an unresolved external?[/URL] | |
Re: A couple of suggestions; [LIST] [*]Maybe change the signature of [ICODE]int mv(...) [/ICODE] to [ICODE]void mv(...) [/ICODE] Currently you have the function returning a value, which is completely ignored by the [ICODE]main()[/ICODE] function, hence serving no practical use. And in case of errors, you throw exceptions, which makes the 'return … | |
Re: > `Arrival.h:7: error: expected class-name before ‘{’ token` > > `#ifndef ARRIVAL_H` > `#define ARRIVAL_H` > > `#include "Event.h"` > > `using namespace std;` Most likely you are not including anything from the std namespace via the Event .h, so the `namespace std` remains unknown to the compiler and cannot … | |
Re: [QUOTE=p.jeet;1144028] COuld any one help me in solving tis issue?[/QUOTE] If you had posted the code using [I]code tags[/I], the code would probably be readable. Now it is not. Perhaps see [URL="http://www.daniweb.com/forums/misc-explaincode.html"]What are code tags?[/URL]. | |
Re: [QUOTE=sexyzebra19;1144090]I had a similar problem with my program crashing earlier, see [url]http://www.daniweb.com/forums/thread263455.html[/url] and i was advised to do this...is it not correct?[/QUOTE] Jonsca already pretty much explained your current situation, but I still try to clearly point out what is wrong below ... [code] Matrix::Matrix(int rows, int cols) { // … | |
Re: Just in case you don't know about illegal filenames, see [URL="http://en.wikipedia.org/wiki/File_name#Reserved_characters_and_words"]Filename / Reserved characters and words[/URL] So having a filename containing e.g. semicolon(s), would quite likely be a mission impossible. | |
Re: [QUOTE=rjani1;1143528]I have tried that but this does not produce an output on the screen. I always seem to have to use the newline character (\n) in order to get anything.[/QUOTE] Have you tried [ICODE]fflush(stdout);[/ICODE] ? | |
Re: [QUOTE=niro_fernando;1143526]plz i want to know information about class libraries in C C++ Java .i want to know about History,how they work , etc[/QUOTE] That's a rather broad question to be answered (don't you think?), so maybe start for example [URL="http://en.wikipedia.org/w/index.php?title=Special%3ASearch&redirs=0&search=class+library+&fulltext=Search&ns0=1"]here[/URL]. | |
Re: [URL="http://www.cplusplus.com/reference/clibrary/cstdio/fprintf/"]fprintf()[/URL] takes a [ICODE]FILE *[/ICODE] as its [I]first argument[/I] (which would be in your case the variable [ICODE]customer[/ICODE]). Then your logic is backwards, in the sense that if the file is opened succesfully, you inform the user about it. But if the opening of the file fails, you'll be trying … | |
Re: [QUOTE=sgw;1142973]Bloodshed Dev C++.[/QUOTE] Bloodshed Dev C++ is actually the IDE, i.e not a compiler. Perhaps you are using MingW's [I]GCC[/I]? | |
Re: After the failed attempt to open the file, [ICODE]inFile[/ICODE] is in error state. You want to do [ICODE]inFile.clear();[/ICODE] to make it functional again. | |
Re: Two options to make this sort(...) work, would be Make the [ICODE]fooSort()[/ICODE] a [I]static[/I] member function, so .. [code] [I]static[/I] bool fooSort(const Foo * fooPointer1, const Foo * fooPointer2) { return fooPointer1->fooMember1 < fooPointer2->fooMember2; } [/code] or take the [ICODE]fooSort()[/ICODE] function outside of the class completely, so .. [code] bool … | |
Re: [QUOTE=CppBuilder2006;1138796]why does this program have an exception in VC++ 2008 Express? I tested it in a borland compiler & there was no exception.[/QUOTE] VC probably destructs the object as soon as the reference has been set i.e. before any output. Just out of curiosity, when you run the program under … | |
Re: [QUOTE=sexyzebra19;1143037]I am not able to change anything in the header file, so is there a way to initalize these variables within the .cpp file? [/QUOTE] Yes, there is. For example, [code] Matrix::Matrix(int mdim_, int ndim_) { this->mdim_ = mdim_; this->ndim_ = ndim_; [/code] You could/should also change to .. [code] … | |
Re: [QUOTE=abhimanipal;1140797]This code gives compile time error but I am unable to understand the reason. [/QUOTE] Which error? Only thing that I see missing, is a header file for [ICODE]getch();[/ICODE]. [EDIT] Oh, and it leaks memory ;) | |
Re: If the private data is [I]static[/I], i.e. all instances of the class share the static private data, then there is no need for the class object as an argument. If the private data is [I]non-static[/I], then you must have the class object as an argument because the object instance actually … | |
Re: [QUOTE=techie929;1142584]Line 40[/QUOTE] Since [ICODE]tree_node[/ICODE] is nested inside the [ICODE]BinarySearchTree[/ICODE] class, you need to apply the scope resolution operator .. [code] [B]BinarySearchTree[/B]::tree_node * BinarySearchTree::inorderSuccessor(tree_node* p ){} [/code] or make the [I]declaration of [/I][I]tree_node public[/I] and use a typedef .. [code] typedef BinarySearchTree::tree_node treeNode; treeNode * BinarySearchTree::inorderSuccessor2(tree_node* p ){} [/code] | |
Re: Adding to what's been said above, GCC spotted a thing in the [ICODE]list()[/ICODE] function, it said; [B]warning: too many arguments for format[/B] That means that the [ICODE]printf(...)[/ICODE] call there needs attention. There is a mismatch between the format string and the number of arguments you actually pass in. Then you … | |
Re: [QUOTE=techie929;1141517]//when I delete root node from bst [/QUOTE] line 29: declares [ICODE]tree_node* parent[/ICODE] (and leaves it [I]uninitialized[/I]) Then, if the root node will be a match for the data you search for, you end up using the uninitialized pointer from line 44 onwards. | |
Re: [QUOTE=indigo.8;1142112] I replaced the Cin>> with system("pause") and system ("CLS") and still have the same issues but when they are removed the pointer is passed to the display class correctly.[/QUOTE] The [ICODE]int Signal[280];[/ICODE] being local to the [ICODE]FileFunc::LoadFile()[/ICODE] function is a guaranteed source of trouble for you. You may detect … | |
Re: One option would be to read in one character at the time, using e.g. [URL="http://www.cplusplus.com/reference/clibrary/cstdio/fgetc/"]fgetc()[/URL], filtering out the unwanted characters. To write to output file, you'd probably like to use the counterpart [ICODE]putc()[/ICODE]. This would narrow down the task at hand, which might be a good idea given your 5 … | |
Re: [QUOTE=Matt323;1140927]I run it again and it opens the key, however i still can't see this key in regedit, after restarting the program multiple times and refreshing.[/QUOTE] If you don't see your program output the "Checking for config failed" text, then the key [I]is[/I] in the registry, in other words the … | |
Re: [QUOTE=johndoe444;1140018]I don't want to declare child as pointer. Is this possible to keep it as array instead of pointer?[/QUOTE] A bit unclear to me will you be writing C or C++. But anyway, if C++ is allowed, you might store the child nodes in a std::vector, so .. [code] struct … | |
Re: [QUOTE] Another issue: I draw the picture not directly on the Form, but on the Panel. The[I] DoubleBuffering property is protected[/I] here :( [/QUOTE] You might derive from Panel class and use the derived class as your Panel with DoubleBuffering enabled. Lukezzz was doing the same thing [URL="http://www.daniweb.com/forums/thread258242.html"]here[/URL]. Though it … | |
Re: [QUOTE=themarval;1139517] .cpp files? even for such a short program?[/QUOTE] As far as I understood, this seems to be partly about having multiple files in your project, hence two .cpp files plus a header. Have yourself [I]main.cpp[/I], which comes with the [ICODE]main()[/ICODE] function implementation and #includes the header file (.h). The … | |
Re: When you have a static non-const member variable, it also needs definition outside the class declaration, so you need to have it like [code] <snip> class HotDogStand { public: void JustSold(); int Cart; int IdNumber; int SalesToday; int TotalSales; int IncrementalSale; static int DogCounter; }; // definition here, outside the … | |
Re: I think this might be related to the file's content. Try saving the following numbers to your file (with e.g. Notepad) and see if it makes a difference. 1 2 3 | |
Re: The file that you posted above (that is, your post #1), actually contains both #include <iostream> using namespace std; So given that you are really getting those errors that you posted, now, are you absolutely sure that you are compiling the correct file(s)? I have a hunch that you are … | |
Re: [QUOTE=Marson;1138878]Unless I am misunderstanding, which is completely possible haha[/QUOTE] Ancient Dragon didn't say that the keywords are to be hard-coded. So you'll just have to process the command line arguments and gather the keywords for later lookups. Depending on how many keywords there could be, it might be easier to … |
The End.