User Tools

Site Tools


pentominos:libartefact

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
pentominos:libartefact [2010/01/29 08:50] – created devapentominos:libartefact [2010/01/29 09:04] deva
Line 4: Line 4:
 The library takes care of http communication, encryption/decryption (optionally), XML translations and error handling. The library takes care of http communication, encryption/decryption (optionally), XML translations and error handling.
 It is intended as a complete interface to the communication possibilities with the Artefact server. It is intended as a complete interface to the communication possibilities with the Artefact server.
 +
 +=====How to use libartefact=====
 +To use libartefact, simply include ''libartefact.h'' in your c file.
 +The project supplies a pkg-config file called libartefact.pc, that should be located in the ''${prefix}/lib/pkgconfig/'', where ''${prefix}'' is the base directory in which the library is installed. This will be ''/usr'' on most systems.
 +In order to use it simply add 
 +<code autoconf>
 +PKG_CHECK_MODULES(ATF, libartefact >= 0.0.2)
 +</code>
 +to ''configure.in'', and supply ''ATF_CFLAGS'' to the cflags and ''ATF_LIBS'' to the libs of your project ''Makefile.am''.
 +Alternatively use the ''pkg-config --libs libartefact'' and ''pkg-config --cflags libartefact'' commands directly in your ''Makefile'' (if not using autotools).
  
 =====API overview===== =====API overview=====
-<code c> 
  
 +<code c>
 +atf_handle_t *handle = atf_init();
 +void atf_close(handle);
 </code> </code>
  
 =====Error handling===== =====Error handling=====
 <code c> <code c>
 +
 +// ... here should be some code that allocates handle and does something useful ...
 +
 atf_error_t err = atf_get_last_error(handle); atf_error_t err = atf_get_last_error(handle);
  
-char buf[512]; +if(err != ATF_NO_ERROR) { 
-printf("Error: %s\n", atf_get_error_string(err, buf, sizeof(buf));+  char buf[512]; 
 +  printf("Error: %s\n", atf_get_error_string(err, buf, sizeof(buf)); 
 +}
 </code> </code>
pentominos/libartefact.txt · Last modified: 2010/01/29 09:14 by deva