1,174 Posted Topics
Re: I believe you are looking for [URL="http://msdn.microsoft.com/en-us/library/ms633522%28v=vs.85%29.aspx"]GetWindowThreadProcessId()[/URL] | |
Re: Note that [ICODE]i[/ICODE] is incremented at line 10 [code=c] m=b[i++]; [/code] | |
Re: [QUOTE=Visual C++] z:\in common folder 24_09\programming\exercises deitel and deitel\ex 5.20 p242\triangle_main.cpp(7) : error C2628: 'Triangle' followed by 'int' is illegal ([COLOR="Red"]did you forget a ';'[/COLOR]?) [/QUOTE] Your compiler is making an 'educated guess' -- you need to terminate the class [ICODE]Triangle[/ICODE] definition with a semicolon. | |
Re: [QUOTE] The function "getinput();" is a prototype function.. But prototype functions work wonders.. especially in situations like these![/QUOTE] I'm guessing that triumphost meant to say [URL="http://en.wikipedia.org/wiki/Function_prototype"]function prototype[/URL] | |
![]() | Re: You seem to be missing a semicolon .. [CODE] class CGame { ... } ; // <--- add semicolon [/code] ![]() |
Re: [QUOTE=privs] Can anyone provide me with a link to how to create and read from ini files.[/QUOTE] You might read up on the [ICODE]GetPrivateProfile...()[/ICODE] and [ICODE]WritePrivateProfile...()[/ICODE] functions, see [URL="http://msdn.microsoft.com/en-us/library/ms724875%28v=VS.85%29.aspx"]Registry Functions[/URL] | |
Re: A note regarding clipboard usage, whenever you successfully open the clipboard, don't forget to close it by calling [B]CloseClipboard()[/B] when you're done with the clipboard operations. | |
Re: One way to do it is to use std::ostringstream [code] int x = 123; std::ostringstream osstream; osstream << x; std::string string_x = osstream.str(); // string_x is now "123" [/code] | |
Re: Shouldn't you fix those if statements to be like ... [code] if(isGet == 0) [/code] | |
Re: Include [ICODE]<windows.h>[/ICODE] [code] #include <windows.h> #include <mysql/mysql.h> ... [/code] | |
Re: >> That works, to a point. Things got pretty ugly, though, when I added the old ... >> ... I only want the #define type statements to pre-process, not the #include. Perhaps you'd like to 'guard' your [ICODE]#include[/ICODE]s with [ICODE]#ifdef[/ICODE]s, like so .. [code] // foo.cpp #ifdef VERNON_COMPILES #include <iostream> … | |
Re: >> There has been an improvement. It runs a few seconds faster ... Console output is slow, you might simply delete the line [code] cout << "a " << a << " b " << b << endl; [/code] altogether. | |
Re: Something spotted .. what's up with line #1057 [CODE] for(int j=5; j<-1; j++) [/CODE] ? | |
Re: For a very short description of a dialog box procedure, see [URL="http://www.winprog.org/tutorial/dialogs.html"]Dialogs[/URL]. Especially your usage of [ICODE]DefWindowProc()[/ICODE] in a dialog box procedure is a big no-no. | |
Re: >> But I am still a bit confused why did it work on old Turboc compilers. See [URL="http://c-faq.com/malloc/lucky.html"]comp.lang.c FAQ list · Question 7.3b[/URL] | |
Re: [QUOTE=Dingbats] Would the OS or the compiler make a difference?[/QUOTE] Your attempt is just a tad bit off, basically you could try [code] HANDLE H = CreateMutex(0, TRUE, _T("your_mutex_name_here")); if(H == NULL) { // Strict failure, GetLastError() will tell you more, perhaps ExitProcess() } else if(GetLastError() == ERROR_ALREADY_EXISTS) { // … | |
Re: I suppose you ought to begin by changing your account information usage, i.e. [code] //// Instead of ... //// pITask->SetAccountInformation(L"USERNAME",NULL); // .. use valid account information pITask->SetAccountInformation(L"YOUR ACCOUNT HERE", L"ITS PASSWORD HERE"); [/code] See [URL="http://msdn.microsoft.com/en-us/library/aa381276%28v=VS.85%29.aspx"]SetAccountInformation()[/URL] | |
Re: >> I thought I needed to add a constructor with no parameters but that didn't work or I didn't do it right. Both [ICODE]SavingsAccount[/ICODE] and [ICODE]BankAccount[/ICODE] class need to have a default constructor in order for your allocation to succeed. Perhaps you wrote a default constructor for [ICODE]SavingsAccount[/ICODE] but [ICODE]BankAccount[/ICODE] … | |
Re: Your [ICODE]main()[/ICODE] does not have the proper signature for taking arguments, you want to have .. [CODE] #include <iostream> #include <string> #include <cstdlib> using namespace std; int main(int argc, char *argv[]) { ... [/CODE] You might also want to check that [ICODE]argc[/ICODE] is equal to (at least) 2. | |
Re: In [ICODE]ReHeap()[/ICODE], comparison is used instead of assignment .. [code] if (left < mySize && myArray[left] > myArray[root]) largest == left; // <--- Wrong [/code] You should catch this by enabling basic warnings, i.e. compiling with e.g.[ICODE]-Wall -Wextra[/ICODE]. Also in [ICODE]ReHeap()[/ICODE], check that [ICODE]left[/ICODE] and [ICODE]right[/ICODE] are not negative when … | |
Re: >> Debug Assertion Failed! >> Expression: (((_Src))) != NULL This interesting error message pops up because you are passing a NULL pointer as a second argument ([ICODE]_Src[/ICODE]) to [ICODE]strcpy_s()[/ICODE] -- you have to be careful not to do that. This NULL pointer is likely to originate from one of the … | |
Re: >> and these are the erros i get when i try ot compile it: >> main.cpp:4: error: '::main' must return 'int' See [URL="http://www.parashift.com/c++-faq-lite/newbie.html#faq-29.3"]Should I use void main() or int main()?[/URL] | |
Re: Quite likely your project is configured to [URL="http://msdn.microsoft.com/en-us/library/z0atkd6c.aspx"]use precompiled headers[/URL] through "stdafx.h". In other words, you'll need to change the order of your includes, in order for the compiler to see <mysql.h>. You could try .. [CODE] #include "stdafx.h" // First stdafx.h #include <cstdio> #include <windows.h> #include <mysql.h> int main() … | |
Re: >> it seems that the WM_CLOSE message is being sent to my program for some reason. Your [ICODE]WM_SYSCOMMAND[/ICODE] handling needs fixing. As of now, any [ICODE]WM_SYSCOMMAND[/ICODE] with [ICODE]wParam[/ICODE] not equal to [ICODE]SC_SCREENSAVE[/ICODE] or [ICODE]SC_MONITORPOWER[/ICODE] falls through to the next case, ending up in a [ICODE]PostQuitMessage (0);[/ICODE] call. | |
Re: Instead of being returned, [ICODE]bad_alloc[/ICODE] gets thrown, see [URL="http://www.cplusplus.com/reference/std/new/bad_alloc/"]bad_alloc[/URL]. | |
Re: A suggestion .. why not make use of the fact that [URL="http://www.cplusplus.com/reference/clibrary/cstdio/scanf/"]scanf()[/URL] returns the number of items read? Something along the lines of the following .. [code] #include <stdio.h> int main() { /* Generally, initialize your variables. */ int week = 0, scanned = 0; printf("How Many of The Total … | |
Re: [QUOTE=MissaDev] This pops up...Unhandled exception at 0x00be21e1 in Lab 11a.exe: 0xC0000005: Access violation reading location 0xfeeefeee.[/QUOTE] Well, you [ICODE]delete [][/ICODE] everything you've allocated, and then try to use that memory -- obviously this will not work. Rather do .. [code] ... SortNames(pNames, NumNames); cout << "After sorting the names" << … | |
Re: [QUOTE=fussballer]There is a stack overflow apparently[/QUOTE] To avoid consuming the stack space, make the array global or declare it [ICODE]static[/ICODE]. For example,[code] /* Statically allocated. */ double array_1[32000]; int main() { /* Statically allocated, only visible inside main(). */ static double array_2[32000]; return 0; } [/code] You may want to … | |
Re: >> error system was not declared in the scope If the code involves a call to [URL="http://www.cplusplus.com/reference/clibrary/cstdlib/system/"]system()[/URL], then you need to [ICODE]#include <cstdlib>[/ICODE]. | |
Re: >> and yes i am using OpenProcess(CREATE_THREAD_ACCESS, FALSE, ProcessID); A mere [ICODE]CREATE_THREAD_ACCESS[/ICODE] is not enough, see [URL="http://msdn.microsoft.com/en-us/library/ms682437%28VS.85%29.aspx"]CreateRemoteThread()[/URL]. | |
Re: >> When i put "string user_input;" JUST BEFORE cin>>user_input it will work Line 8 is effectively a comment because you end line 7 with a backslash (it's called line continuation). So, delete the unwanted backslashes .. [code] #include <string> int main() { // declaring variables string user_input; [/code] | |
Re: It seems that this time you don't have the [ICODE]main()[/ICODE] function (previously you had two!). So, add one and see if you get any output. [code] #include <iostream> int main() { std::cout << "testing ...\n"; return 0; } [/code] | |
Re: >> The following part of code is failling at first free call (Line no.26) giving above error. Please use CODE tags when you post code. [code] Valstruct.ch[i] = "Anand"; [/code] Change the above line to use [URL="http://www.cplusplus.com/reference/clibrary/cstring/strcpy/"]strcpy()[/URL] instead of the faulty string literal assignment. [ICODE]free()[/ICODE] is attempting to free memory … | |
Re: There's a glitch at least in [ICODE]mergeArray()[/ICODE], if [ICODE]head[/ICODE] is [ICODE]NULL[/ICODE], you end up doing [ICODE]head->next = newNode;[/ICODE] -- I believe you know how to fix that. | |
Re: You are misusing [ICODE]CheckTokenMembership()[/ICODE] -- for an example, see MSDN [URL="http://msdn.microsoft.com/en-us/library/aa376389%28VS.85%29.aspx"]CheckTokenMembership()[/URL] | |
Re: >> Below is the program for swapping variables without any extra variable. May I suggest that you view for example [URL="http://www.daniweb.com/forums/post1115685.html#post1115685"]this thread[/URL] ;) | |
Re: Wait -- would a plain assignment suffice? [CODE]copyRow = vec2d[3];[/CODE] | |
Re: >> unfortunately it still doesnt work.. I'm guessing that lines 83 and 84 are still wrong (assigning to local temporaries [ICODE]h[/ICODE] and [ICODE]w[/ICODE]). Furthermore, you also have to explicitly call the base class' [ICODE]operator =()[/ICODE] in order to make the assignment fully work, this doesn't happen automatically. | |
Re: >> obvious coding problems? The basic functionality is somewhat lacking, e.g. [ICODE]toBinary()[/ICODE] would not output anything, given the input zero -- a do/while loop might work better. >> It is a bit inconsistent because I didn't use the stack on the hex conversion. Why not use a stack for that … | |
Re: There seems to be an extraneous [COLOR="Red"]period[/COLOR] there .. [ICODE]cout << setw[COLOR="Red"][B].[/B][/COLOR]((text.length() + lineLength) /2) << text << endl;[/ICODE] | |
Re: There are two glaring errors, namely [code] delete[] square[i]; // and free(square); [/code] Simply delete those lines because [ICODE]square[/ICODE] is not dynamically allocated -- doing that may fix the program. Perhaps see [URL="http://www.parashift.com/c++-faq-lite/freestore-mgmt.html"]Freestore management[/URL]. | |
Re: I'm not quite sure what it is that you are exactly asking, but you may get some ideas from the following. Since you already include <windows.h>, you can use the [ICODE]Sleep()[/ICODE] Windows API. [code] #include <stdio.h> #include <windows.h> void print_welcome(void) { printf ( "\n\n\n\n" "\t\t ***************************************\n" "\t\t ***************************************\n" "\t\t *** … | |
Re: The problem is in the [ICODE]extPersonType()[/ICODE] constructor where you pass the uninitialized member variables [ICODE]firstName[/ICODE] and [ICODE]lastName[/ICODE] to the base class constructor, i.e. trying to initialize uninitialized variables with copies of themselves. Since the base class constructor has default parameters, the fix is easy, i.e. [code] extPersonType::extPersonType(string extRelation, string extPhone) … | |
Re: You need to move the definition to a source file (.cpp), e.g. [CODE] // file: prereq.cpp #include "prereq.h" int UtilFunc::PositionMap[MAP_WIDTH*MAP_HEIGHT] = {0}; [/CODE] | |
Re: Nowhere are you modifying the two matrices declared in [ICODE]main()[/ICODE] -- they remain zero-initialized throughout the program. Remedy this by deleting the local [ICODE]int C[3][3][/ICODE] matrix in the [ICODE]MatrixConverter()[/ICODE] and modify the passed-in [ICODE]x[/ICODE] matrix instead. | |
Re: >> problem is with error handling.. where in the program should not engage in an endless loop if for example a a letter instead of a number was entered. See e.g. [URL="http://www.parashift.com/c++-faq-lite/input-output.html#faq-15.2"]http://www.parashift.com/c++-faq-lite/input-output.html#faq-15.2[/URL] | |
Re: In addition to what's already stated above, I'd like to suggest a beginner-friendly [URL="http://www.learncpp.com/"]C++ Tutorial[/URL]. | |
Re: >> My problem is that only one textbox is created on the form. I'm not sure why 3 textboxes aren't being created (because there are 3 rows in the table "Contact"). It looks like the boxes are created on top of each other, i.e. effectively the location of each box … | |
Re: Good points by Adak. I'd like to add that, why not simply check what [ICODE]malloc()[/ICODE] returns, along the lines of .. [code] buffer = malloc(VSN_BUF_SIZE + 1); if(buffer == NULL) { /* Display error message and perhaps exit */ perror("malloc()"); exit(EXIT_FAILURE); } [/code] In case the reason is not an … | |
Re: >> I'm trying to iterate backwards through a vector. Consider using a reverse iterator, for an example, have a look at [URL="http://www.cplusplus.com/reference/stl/vector/rbegin/"]vector::rbegin()[/URL]. |
The End.