objective-c++ って最強じゃね? osX上では、そんな気がしてきた
# by mizt07 | 2008-09-26 07:47
# by mizt07 | 2008-09-26 07:47
# by mizt07 | 2008-09-26 07:16
cocoaなんだけれど面白いほどcocoaでない件についてwww
#import "svgtest.h"
#include "dlfcn.h"
#define MAXPATHLEN 1024
void saveSVG(char *svg) {
CFURLRef pathCFURLRef;
CFStringRef pathCFString;
char *path=(char *)malloc(MAXPATHLEN*sizeof(char));
pathCFURLRef=CFBundleCopyBundleURL(CFBundleGetMainBundle()); // Get path to application bundle.
pathCFString=CFURLCopyFileSystemPath(pathCFURLRef, kCFURLPOSIXPathStyle);
CFStringGetCString(pathCFString, path, MAXPATHLEN, CFStringGetSystemEncoding());
CFRelease(pathCFString);
CFRelease(pathCFURLRef);
char *s=path;
int cnt=0;
while(*s!='\0') { if(*s++=='/') ++cnt; }
s=path;
while(cnt) { if(*s++=='/') --cnt; }
*s='\0';
/*
Dl_infoinfo;
if(dladdr((const void *)__func__,&info))
{
char *path=dirname( info.dli_fname );
char *s=path;
int cnt=-2;
while(*s!='\0') { if(*s++=='/') ++cnt; }
s=path;
while(cnt) { if(*s++=='/') --cnt; }
*s='\0';
}
*/
strcat(path,"test.svg");
FILE *f=f0pen(path,"w");
fputs(svg,f);
fclose(f);
free(path);
}
@implementation svgtest
-(IBAction)click:(id)sender {
saveSVG("test");
}
@end
//fputs([data cStringUsingEncoding:NSUTF8StringEncoding], f);
# by mizt07 | 2008-09-26 06:39
# by mizt07 | 2008-05-23 14:06
# by mizt07 | 2008-05-20 02:18
< 前のページ 次のページ >