1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
|
/***************************************************************************
begin : Tue May 03 2005
copyright : (C) 2018 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 <aqbanking/banking.h>
#include <gwenhywfar/cgui.h>
int main(int argc, char **argv)
{
AB_BANKING *ab;
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 successful return
* from this function that any other AqBanking function may be used.
*/
rv=AB_Banking_Init(ab);
if (rv) {
fprintf(stderr, "Error on init (%d)\n", rv);
return 2;
}
fprintf(stderr, "AqBanking successfully initialized.\n");
/* 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.
*/
rv=AB_Banking_Fini(ab);
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.
*/
AB_Banking_free(ab);
return 0;
}
|