External App connection to a GnuCash file

Daniel Espinosa esodan at gmail.com
Tue Aug 28 18:57:50 EDT 2007


Hi all

As part of the work to Fix bug #470753 and #470767, I'm creating a
test application that access to the GC file using the API in the
Engine and QOF, but I need some help about the following:


/***** HELP No 1 *************/
While compiling my test program I have an error message:

Why I have an error message for the file
/usr/local/include/gnucash/qofutil.h in the line:

#   error "No scanf format string is known for LLD. Fix your
./configure so that the correct one is detected!"

The actual code in qofutil.h file is:

#if HAVE_SCANF_LLD
# define QOF_SCANF_LLD "%lld"
#else
# if HAVE_SCANF_QD
#  define QOF_SCANF_LLD "%qd"
# else
#  if HAVE_SCANF_I64D
#   define QOF_SCANF_LLD "%I64d"
#  else
#   error "No scanf format string is known for LLD. Fix your
./configure so that the correct one is detected!"
#  endif
# endif
#endif


/********** HELP No 2 *************/

What are the steps to open a Session/Book in QOF?

I have the following code:

/*
* Giving a file path file:/route_to_file as an argument
* and
* typedef AppData { QofBook *book; QofSession *session; }
*/
data = g_new0 (AppData, 1);

/* Book has a pointer to QofBackend but not for QofSession*/
data->book = qof_book_new ();

/* Session has a list of books, but never creates a default one */
data->session = qof_session_new ();

/*
* Witch is first: session_begin or add_book?
* I can't find the way to asure the book added is populated with the
data from the
* Backend
*/

/* This inits session but a book isn't added to the session */
qof_session_begin (data->session, uri, TRUE, FALSE);

/* This add the book to the session, but it isn't populated */
qof_session_add_book (session, book);

/************/

I'm using URI as the file's path.

Are there any Tutorial to use GnuCash's QOF?

-- 
Trabajar, la mejor arma para tu superación
"de grano en grano, se hace la arena" (R) (entrámite, pero para los
cuates: LIBRE)



More information about the gnucash-devel mailing list