shuerhaaken avatar shuerhaaken committed 63f0ce5

add some sample code

Comments (0)

Files changed (4)

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;
+    }
+}

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);

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;
+    }
+}

tests/ctest_read/main.c

 #include <stdio.h>
 #include <taginfo_c.h>
-#include <stdlib.h>
 
 int main(void)
 {
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.