1,174 Posted Topics

Member Avatar for Prosammer

I believe you are looking for [URL="http://msdn.microsoft.com/en-us/library/ms633522%28v=vs.85%29.aspx"]GetWindowThreadProcessId()[/URL]

Member Avatar for Prosammer
0
912
Member Avatar for ram619
Member Avatar for ram619
0
87
Member Avatar for Violet_82

[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.

Member Avatar for Violet_82
0
900
Member Avatar for ndowens

[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]

Member Avatar for jonsca
0
181
Member Avatar for trebor-pl

You seem to be missing a semicolon .. [CODE] class CGame { ... } ; // <--- add semicolon [/code]

Member Avatar for trebor-pl
0
338
Member Avatar for privs

[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]

Member Avatar for jonsca
0
210
Member Avatar for n00b3

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.

Member Avatar for Panda_007
0
5K
Member Avatar for Jennifer84

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]

Member Avatar for Nowayz
0
635
Member Avatar for Dizzzy
Member Avatar for NicAx64
0
266
Member Avatar for logicslab

Include [ICODE]<windows.h>[/ICODE] [code] #include <windows.h> #include <mysql/mysql.h> ... [/code]

Member Avatar for mitrmkar
0
1K
Member Avatar for VernonDozier

>> 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> …

Member Avatar for VernonDozier
0
174
Member Avatar for mrcpp

>> 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.

Member Avatar for mrcpp
0
310
Member Avatar for Clinton Portis

Something spotted .. what's up with line #1057 [CODE] for(int j=5; j<-1; j++) [/CODE] ?

Member Avatar for Clinton Portis
0
166
Member Avatar for hiddepolen

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.

Member Avatar for hiddepolen
0
1K
Member Avatar for vinitmittal2008

>> 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]

Member Avatar for vinitmittal2008
0
222
Member Avatar for Dingbats

[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) { // …

Member Avatar for Dingbats
0
1K
Member Avatar for subrat.agasti

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]

Member Avatar for subrat.agasti
0
199
Member Avatar for ajireland

>> 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] …

Member Avatar for mitrmkar
0
240
Member Avatar for SgtMe

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.

Member Avatar for SgtMe
0
484
Member Avatar for Toxic_Rice

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 …

Member Avatar for Toxic_Rice
0
237
Member Avatar for rebellion346

>> 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 …

Member Avatar for rebellion346
0
233
Member Avatar for TechieNoob

>> 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]

Member Avatar for mitrmkar
0
331
Member Avatar for localp

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() …

Member Avatar for localp
0
274
Member Avatar for tomtetlaw

>> 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.

Member Avatar for tomtetlaw
0
160
Member Avatar for NichtSoGut

Instead of being returned, [ICODE]bad_alloc[/ICODE] gets thrown, see [URL="http://www.cplusplus.com/reference/std/new/bad_alloc/"]bad_alloc[/URL].

Member Avatar for StuXYZ
0
481
Member Avatar for gahhon

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 …

Member Avatar for Kamatari
0
118
Member Avatar for MissaDev

[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" << …

Member Avatar for mitrmkar
0
131
Member Avatar for fussballer

[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 …

Member Avatar for mitrmkar
0
244
Member Avatar for Hayzam_#include

>> 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].

Member Avatar for Hayzam_#include
0
100
Member Avatar for lochnessmonster

>> 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].

Member Avatar for mitrmkar
0
118
Member Avatar for sha11e

>> 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]

Member Avatar for mitrmkar
0
87
Member Avatar for MyPianoSucks

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]

Member Avatar for MyPianoSucks
0
191
Member Avatar for pinkannu

>> 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 …

Member Avatar for pinkannu
0
130
Member Avatar for xxunknown321

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.

Member Avatar for xxunknown321
0
174
Member Avatar for lochnessmonster

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]

Member Avatar for mitrmkar
0
1K
Member Avatar for murtazamzk

>> 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] ;)

Member Avatar for Kamatari
0
177
Member Avatar for dorien
Member Avatar for dorien
0
1K
Member Avatar for oggiemc

>> 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.

Member Avatar for nbaztec
0
138
Member Avatar for anthonys1mom

>> 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 …

Member Avatar for mitrmkar
0
2K
Member Avatar for mommabear

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]

Member Avatar for mommabear
0
243
Member Avatar for stvnddich

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].

Member Avatar for stvnddich
0
144
Member Avatar for gahhon

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 *** …

Member Avatar for gahhon
0
150
Member Avatar for centerline00

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) …

Member Avatar for Fbody
0
237
Member Avatar for chamika.deshan

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]

Member Avatar for chamika.deshan
0
2K
Member Avatar for rebellion346

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.

Member Avatar for mitrmkar
0
2K
Member Avatar for whodoes21

>> 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]

Member Avatar for whodoes21
0
208
Member Avatar for M a H a

In addition to what's already stated above, I'd like to suggest a beginner-friendly [URL="http://www.learncpp.com/"]C++ Tutorial[/URL].

Member Avatar for Fbody
0
404
Member Avatar for shakssage

>> 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 …

Member Avatar for Stefano Mtangoo
0
261
Member Avatar for nonshatter

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 …

Member Avatar for mitrmkar
0
116
Member Avatar for wazzer225

>> 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].

Member Avatar for mitrmkar
0
112

The End.