Example of a program that uses the TwitPic library.

Dependencies:   EthernetNetIf TwitPic mbed DNSResolver

Revision:
0:4a6b01bf147d
Child:
1:44a07cd54a87
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Feb 26 20:10:39 2011 +0000
@@ -0,0 +1,42 @@
+#include "TwitPic.h"
+
+#define IMAGE_PATH "/local/image.jpg"
+
+const char twitpic_api_key[]    = "31c45945be2638bydjua1c4d4278d9602"; 
+
+const char consumer_key[]        = "Hl1fObuUdobieyHZtsw52qg";  
+const char consumer_secret[]     = "7CmMt8nTTYKM2F6nPMSiC2DqFPYmKDZOUc3lvWIJsFk"; 
+
+
+const char access_token[]        = "8839572789-uUjbndiYi2EOutUvsMYkJNcK9JtRbWhU"; 
+const char access_token_secret[] = "kLXd6xmIkdTS098Jb97EOBHCZkIyOZCxlYQTdug"; 
+
+int main() {
+    TwitPic twitpic(twitpic_api_key,consumer_key,consumer_secret,access_token,access_token_secret);  
+    LocalFileSystem local("local");
+    EthernetNetIf network;
+    
+    
+    printf("Setting up network...\n");
+    EthernetErr ethErr = network.setup();
+    if (ethErr) {
+        printf("Error %d in network setup.\n", ethErr);
+        return -1;
+    }
+    printf("Network Setup OK\n");
+
+    printf("Opening File...\n");
+    FILE *img = fopen(IMAGE_PATH, "r");
+    if (img == NULL) {
+        printf("Error in file open.\n");
+        return -1;
+    }
+    printf("File open.\n");
+   
+    int ret = twitpic.uploadAndPost("What the what?", img);
+    if (ret < 0) {
+        printf("Twitpic upload failed with error %i",ret);
+        return ret;
+    }
+    return 0;
+}
\ No newline at end of file