Commits

shuerhaaken  committed 63f0ce5

add some sample code

  • Participants
  • Parent commits 4e61c2a

Comments (0)

Files changed (4)

File examples/tagreader.cpp

+#include "taginfo.h"
+#include <stdio.h>
+#include <iostream>
+
+#define TESTNAME "xyz 1 23"
+
+using namespace TagInfo;
+
+int main( void ) {
+    Info * info;
+    
+    //WRITING
+//    info = Info::create_tag_info("path/to/file.mp3");
+//    
+//    if( info ) {
+//        info->set_title(TESTNAME);
+//        info->write();
+//        delete info;
+//    }
+    
+    //READING
+    info = Info::create_tag_info(target);
+    if( info ) {
+        if( info->read() ) {
+            char* title = info->get_title();
+            printf("title: %s\n", title);
+            free(title);
+        }
+        delete info;
+    }
+}

File examples/tagreader_c.c

     info = taginfo_info_factory_make("./path/to/file.mp3");
 
     if(info == NULL)
-      break;
+      return 1;
 
     if(taginfo_info_read(info)) {
       char* name = taginfo_info_get_title(info);

File examples/tagwriter.cpp

+#include "taginfo.h"
+#include <stdio.h>
+#include <iostream>
+
+#define TESTNAME "xyz 1 23"
+
+using namespace TagInfo;
+
+int main( void ) {
+    Info * info;
+    
+    //WRITING
+    info = Info::create_tag_info("path/to/file.mp3");
+    
+    if( info ) {
+        info->set_title(TESTNAME);
+        info->write();
+        delete info;
+    }
+    
+    //READING
+    info = Info::create_tag_info(target);
+    if( info ) {
+        if( info->read() ) {
+            char* title = info->get_title();
+            printf("title: %s\n", title);
+            free(title);
+        }
+        delete info;
+    }
+}

File tests/ctest_read/main.c

 #include <stdio.h>
 #include <taginfo_c.h>
-#include <stdlib.h>
 
 int main(void)
 {