And here's the minimal example to create a TAB file. It seems as though you
have to have at least one field for Mitab to output a valid TAB file that
MapInfo can read!
mitab_handle hTAB = mitab_c_create("C:\\tmp\\test.tab","tab","CoordSys Earth
Projection 1, 0",-32.0,-34.0,152.0,150.0);
if (hTAB!=NULL)
{
int nField = mitab_c_add_field(hTAB,"Test",TABFT_Integer,0,0,0,0);
double xs[1];
double ys[1];
xs[0] = 151.0; ys[0] = -33.0;
mitab_feature hFeature;
hFeature = mitab_c_create_feature(hTAB,TABFC_Point);
mitab_c_set_field(hFeature,nField,"1");
mitab_c_set_points(hFeature,0,1,xs,ys);
mitab_c_write_feature(hTAB,hFeature);
mitab_c_destroy_feature(hFeature);
xs[0] = 151.1; ys[0] = -33.1;
hFeature = mitab_c_create_feature(hTAB,TABFC_Point);
mitab_c_set_field(hFeature,nField,"2");
mitab_c_set_points(hFeature,0,1,xs,ys);
mitab_c_write_feature(hTAB,hFeature);
mitab_c_destroy_feature(hFeature);
}
mitab_c_close(hTAB);
--- On Tue, 21/10/08, Mikael Larsson <[EMAIL PROTECTED]> wrote:
From: Mikael Larsson <[EMAIL PROTECTED]>
Subject: RE: [mitab] catching exceptions from the mitab library.
To: [email protected]
Received: Tuesday, 21 October, 2008, 5:55 AM
Yes, but that does not work for me.
I never enter the catch-part, I still get a crash on the same line of code.
To: [EMAIL PROTECTED] com
From: [EMAIL PROTECTED] .com
Date: Mon, 20 Oct 2008 14:42:29 -0700
Subject: Re: [mitab] catching exceptions from the mitab library.
Have you tried adding a try { .... } catch (..) { } block around the call that
crashes ?
--- On Sun, 19/10/08, Mikael Larsson <[EMAIL PROTECTED] com> wrote:
From: Mikael Larsson <[EMAIL PROTECTED] com>
Subject: [mitab] catching exceptions from the mitab library.
To: [EMAIL PROTECTED] com
Received: Sunday, 19 October, 2008, 9:52 PM
Hello!
I'm writing a software to convert a file from one coordinate system to another.
I do this by reading the different objects from the file with the available
functions, transform the coordinates and write back the object to a new output
file.
For one input file I get an exception when calling the mitab_c_write_ feature
function. The exception originates in the function PickSeedsForSplit found in
the file mitab_mapindexblock .cpp. The problem seems to be that nSrcHeight or
nSrcWidth can be equal to zero. Then the division on line 1065 will not work
and an exception is thrown.
Is there any way to catch this exception in my MFC application? I would very
much like to avoid a software crash because of this.
I'm using the latest version (1.7.0).
Can anyone please advise?
Best Regards
Mikael Larsson
Connect to the next generation of MSN Messenger Get it now!
Send instant messages to your online friends http://au.messenger .yahoo.com
Explore the seven wonders of the world Learn more!
Make the switch to the world's best email. Get Yahoo!7 Mail!
http://au.yahoo.com/y7mail