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); }
00001 00033 #include <stdio.h> 00034 #include <annodex/annodex.h> 00035 00036 static int 00037 read_head (ANNODEX * anx, const AnxHead * head, void * user_data) 00038 { 00039 puts (head->title); 00040 return ANX_CONTINUE; 00041 } 00042 00043 int 00044 main (int argc, char *argv[]) 00045 { 00046 ANNODEX * anx = NULL; 00047 char * filename; 00048 long n; 00049 00050 if (argc != 2) { 00051 fprintf (stderr, "Usage: %s file.anx\n", argv[0]); 00052 exit (1); 00053 } 00054 00055 filename = argv[1]; 00056 00057 anx = anx_open (filename, ANX_READ); 00058 00059 anx_set_read_head_callback (anx, read_head, NULL); 00060 00061 while ((n = anx_read (anx, 1024)) > 0); 00062 00063 anx_close (anx); 00064 00065 exit (0); 00066 }


Generated on Wed Jul 28 15:36:09 2004 for libannodex by doxygen 1.3.7