[sword-devel] Learning the Sword API

Troy A. Griffitts sword-devel@crosswire.org
Mon, 05 Feb 2001 23:53:33 -0700

Tim Hawes wrote:
> I can tell the Sword API Primer is dated. Even after examining the
> header files, it is still very unclear how I can set a VerseKey to a
> particular reference. This does not work:
> VerseKey *mykey;
> mykey = "jas 1:19";
> Can anyone help me out, here? Thanks in advance.

VerseKey mykey;
mykey = "jas 1:19

-VerseKey *mykey;
+VerseKey mykey;

If you're gonna declare a pointer, you must new the object, then free
it... e.g.

VerseKey *mykey = new VerseKey();
*mykey = "jas 1:19";

// do some stuff with the key

delete mykey;

Maybe a C++Primer might help.