added mp3read.c
authorhackbard <hackbard>
Sun, 13 Apr 2003 18:05:32 +0000 (18:05 +0000)
committerhackbard <hackbard>
Sun, 13 Apr 2003 18:05:32 +0000 (18:05 +0000)
mp3read.c [new file with mode: 0644]

diff --git a/mp3read.c b/mp3read.c
new file mode 100644 (file)
index 0000000..dd61d86
--- /dev/null
+++ b/mp3read.c
@@ -0,0 +1,40 @@
+/* read mp3 info, hackbard */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <string.h>
+
+#define MAX_READ 1024
+#define MAX_FILENAME 256
+
+int main (int argc,char **argv)
+{
+ int file_fd; /* desc fir file */
+ char buf[MAX_READ]; /* buffer for the actual info */
+ char filename[MAX_FILENAME];
+
+ strcpy(argv[1],filename);
+
+ if((file_fd=open(filename,O_RDONLY))<=0) {
+  puts("open failed");
+  return -23;
+ }
+
+ if((read(file_fd,&buf,MAX_READ))<=MAX_READ) {
+  puts("read failed");
+  return -23;
+ }
+
+ printf(" -> %s",buf);
+ puts("");
+ puts("done");
+ return 23;
+}
+
+
+