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?
EXCEPTION DEAL
Re: EXCEPTION DEAL
linares or someone?
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: EXCEPTION DEAL
Are you using Harbour or xHarbour ? What version ?
Re: EXCEPTION DEAL
xharbour 1.2.1 9746 +FWH 12.01+BCC 5.82.
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: EXCEPTION DEAL
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():
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
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
#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
Re: EXCEPTION DEAL
it can be demonstrated, I am grateful. because I'm having more problems. particularly in reading / recording of text files.