Main Page | Modules | Data Structures | File List | Globals | Related Pages

Reading from files and file descriptors
[Reading from Annodex media]

If the Annodex media you wish to access is directly available as a local file or via a file descriptor (such as a network socket), it can be directly opened as follows:

This procedure is illustrated in src/examples/print-title-file.c:

#include <stdio.h>
#include <annodex/annodex.h>

static int
read_head (ANNODEX * anx, const AnxHead * head, void * user_data)
{
  puts (head->title);
  return ANX_CONTINUE;
}

int
main (int argc, char *argv[])
{
  ANNODEX * anx = NULL;
  char * filename;
  long n;

  if (argc != 2) {
    fprintf (stderr, "Usage: %s file.anx\n", argv[0]);
    exit (1);
  }

  filename = argv[1];

  anx = anx_open (filename, ANX_READ);

  anx_set_read_head_callback (anx, read_head, NULL);

  while ((n = anx_read (anx, 1024)) > 0);

  anx_close (anx);

  exit (0);
}


Generated on Sat May 22 19:44:49 2004 for libannodex by doxygen 1.3.5