Question : C++ app exiting incorrectly

I have an application that is exiting incorrectly , i have included some sample code that replicates the issue

The start function calls the test function, however the app shuts down and wont return to execute the line after the call to test, so it never reaches  isresult=false;

any ideas , what is causing this ?

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
void test()
{
	const int cnBufferSize = 256;
	unsigned char achBuffer[cnBufferSize] = {0};
	SMsgBuffer sMsgData = {0};
	 
	memcpy(&sMsgData,achBuffer,cnBufferSize);
		
	bool isresult = true;

}

void start()
{
	bool isresult = true;
	while (isresult)
	{
	   test();
             isresult=false;
	}
          DWORD dwFlags=0;
          //some more calls below 

}

Answer : C++ app exiting incorrectly

you cannot do like that indeed ...
http://www.experts-exchange.com/articles/Database/Miscellaneous/UPDATES-with-JOIN-for-everybody.html
mysql is unfortunately a bit limited in that regards, but you shall check out this:
1:
2:
3:
4:
5:
6:
7:
8:
9:
Update inv i
SET i.total = ( select SUM(v.quantity * s.charges)
          from invitem v
          JOIN service s
             ON s.idservice = v.idservice
          WHERE v.datetime = i.datetime
            AND v.invoiceid = i.id  --- < I presume this link condition is missing also ...
       )
WHERE i.datetime = @uniquekey
Random Solutions  
 
programming4us programming4us