Main Page   Compound List   File List   Compound Members   Examples  

/TestCOMGraphan/Test2.cpp

/*
 This example shows how to load a string into graphematical module
*/

#include <stdio.h>
#include "string.h"
#include <string>
#include "assert.h"
#import "../../bin/graphan.tlb"

// String Example
int main (int argc, char* argv[])
{
  try 
  {
        // init COM
        CoInitialize(NULL);

        // creating COM-object
        GRAPHANLib::IGraphmatFilePtr piGraphan;
        HRESULT hr = piGraphan.CreateInstance(__uuidof(GRAPHANLib::GraphmatFile));
        if (FAILED (hr))
        {
                printf ("Graphan is not registered");
                CoUninitialize();
                return 1;
        };

        // loading dictionaries 
        piGraphan->LoadDicts();

        //  loading a string 
        piGraphan->LoadStringToGraphan("mother goes to the windows");

        _bstr_t t = piGraphan->GetWord(3);

        assert (t == _bstr_t("to"));
  }
  catch(...)
  {
                return -1;
  }
  CoUninitialize();
  return 1;
}

Generated on Sat Jun 25 17:04:48 2005 for Graphan by doxygen1.2.18