EXCEPTION DEAL

EXCEPTION DEAL

Postby gss200610 » Fri Mar 16, 2012 11:52 am

hello everyone, there are some bars lining the errors such as hb_xgrab requested to allocate zero bytes. among others, I tried to use the try catch and does not always work.
the executable stops working. in C + + there is a throw to handle exceptions,
because in my application to each sale item to read a certain amount of text file to add the item sold and rewrite the updated value in text file. More often nothing of the error hb_xgrab requested to allocate zero bytes and the application closes and the User loses all sales in progress.

there is a way to treat it, to block these errors?
gss200610
 
Posts: 36
Joined: Sat Jun 19, 2010 10:09 am
Location: Goiania - Goias - Brasil

Re: EXCEPTION DEAL

Postby gss200610 » Sat Mar 17, 2012 7:44 pm

linares or someone?
gss200610
 
Posts: 36
Joined: Sat Jun 19, 2010 10:09 am
Location: Goiania - Goias - Brasil

Re: EXCEPTION DEAL

Postby Antonio Linares » Sun Mar 18, 2012 12:16 pm

Are you using Harbour or xHarbour ? What version ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42089
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: EXCEPTION DEAL

Postby gss200610 » Sun Mar 18, 2012 3:22 pm

xharbour 1.2.1 9746 +FWH 12.01+BCC 5.82.
gss200610
 
Posts: 36
Joined: Sat Jun 19, 2010 10:09 am
Location: Goiania - Goias - Brasil

Re: EXCEPTION DEAL

Postby Antonio Linares » Mon Mar 19, 2012 7:36 am

My advise is that you migrate to Harbour. That will surely fix it.

Besides that we can use C try... except exceptions in Harbour/xHarbour, but thats not the right way to solve it. Here you an example to trap an exception when calling SysRefresh():

Code: Select all  Expand view
#pragma BEGINDUMP

#include <windows.h>
#include <hbapi.h>
#include <stdio.h>

BOOL SysRefresh( void );

HB_FUNC( NOGPF )
{
   __try
   {
      hb_retl( SysRefresh() );
   }
   __except ( ( hb_retl( TRUE ), TRUE ) )
   {}
}

#pragma ENDDUMP 


As you can jump from low level to high level, you could invoke your Main() from such C routine, so your entire app execution will be controlled by that C++ try ... except code :-) I can show you an example if you don't know how to do it
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42089
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: EXCEPTION DEAL

Postby gss200610 » Mon Mar 19, 2012 11:19 am

it can be demonstrated, I am grateful. because I'm having more problems. particularly in reading / recording of text files.
gss200610
 
Posts: 36
Joined: Sat Jun 19, 2010 10:09 am
Location: Goiania - Goias - Brasil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 102 guests