aqbanking  5.7.8
Tutorial 1 (Basic Usage of AqBanking)

Basic usage of AqBanking. More...

Basic usage of AqBanking.

This tutorial simply creates an instance of AqBanking, initializes and deinitializes it.

You must either choose a frontend to be used with AqBanking or create one yourself by implementing the user interface callbacks of AqBanking.

However, for simplicity reasons we use the console frontend CBanking which implements these callbacks for you.

There are other frontends, e.g. G2Banking for GTK2/Gnome, QBanking for QT3 or KDE3 or KBanking for KDE3.

/***************************************************************************
begin : Tue May 03 2005
copyright : (C) 2005 by Martin Preuss
email : martin@libchipcard.de
***************************************************************************
* This file is part of the project "AqBanking". *
* Please see toplevel file COPYING of that project for license details. *
***************************************************************************/
/***************************************************************************
* This tutorial simply creates an instance of AqBanking, initializes and *
* deinitializes it. *
* *
* You must either choose a GUI implementation to be used with AqBanking *
* or create one yourself by implementing the user interface callbacks of *
* LibGwenhywfar. *
* *
* However, for simplicity reasons we use the console GUI implementation *
* which implements these callbacks for you. *
* *
* There are other GUI implementations, e.g. for GTK2, QT3, QT4 and FOX16. *
***************************************************************************/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gwenhywfar/cgui.h>
int main(int argc, char **argv) {
int rv;
GWEN_GUI *gui;
gui=GWEN_Gui_CGui_new();
GWEN_Gui_SetGui(gui);
/* The first argument is the name of the application. This is needed for
* AqBanking to internally store some application-specific settings.
* This name may contain whatever characters you like, it is escaped
* internally before creating file paths or DB groups from it.
*
* The second argument is the folder in which the AqBanking settings are
* stored. You should in most cases provide NULL here which makes AqBanking
* choose the default path ($HOME/.aqbanking).
* If this folder doesn't exist it will be created as soon as AqBanking has
* something to store (in most cases when closing the application).
*/
ab=AB_Banking_new("tutorial1", 0, 0);
/* This function initializes AqBanking. It is only after successfull return
* from this function that any other AqBanking function may be used.
*/
if (rv) {
fprintf(stderr, "Error on init (%d)\n", rv);
return 2;
}
/* Initialize the only banking part of AqBanking. This is needed to
* actually perform online banking actions (like retrieving account
* statements etc).
*/
if (rv) {
fprintf(stderr, "Error on onlineinit (%d)\n", rv);
return 2;
}
fprintf(stderr, "AqBanking successfully initialized.\n");
/* deinit the online banking part of AqBanking */
if (rv) {
fprintf(stderr, "ERROR: Error on deinit (%d)\n", rv);
return 3;
}
/* You must always call this function before exiting, because only then
* AqBanking's settings are written.
* After this function has been called no other function except
* AB_Banking_free() or AB_Banking_Init() may be called.
*/
if (rv) {
fprintf(stderr, "ERROR: Error on deinit (%d)\n", rv);
return 3;
}
/* The AqBanking instance you created at the beginning must always be
* destroyed using this function to avoid memory leaks.
*/
return 0;
}