added mp3read.c
[my-code/mp3db.git] / mp3read.c
1 /* read mp3 info, hackbard */
2
3 #include <stdio.h>
4 #include <unistd.h>
5 #include <sys/types.h>
6 #include <sys/stat.h>
7 #include <fcntl.h>
8 #include <string.h>
9
10 #define MAX_READ 1024
11 #define MAX_FILENAME 256
12
13 int main (int argc,char **argv)
14 {
15  int file_fd; /* desc fir file */
16  char buf[MAX_READ]; /* buffer for the actual info */
17  char filename[MAX_FILENAME];
18
19  strcpy(argv[1],filename);
20
21  if((file_fd=open(filename,O_RDONLY))<=0) {
22   puts("open failed");
23   return -23;
24  }
25
26  if((read(file_fd,&buf,MAX_READ))<=MAX_READ) {
27   puts("read failed");
28   return -23;
29  }
30
31  printf(" -> %s",buf);
32  
33  puts("");
34  puts("done");
35  
36  return 23;
37 }
38
39
40