[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: coding for standard in

From: tgate
Subject: Re: coding for standard in
Date: Mon, 11 Dec 2006 15:24:31 -0800

I was looking in to this area too - it's still on my todo list - if  
you get anywhere please let me know I'll be interested on how to do  
this myself.

Okay, I'm not sure if this is really the proper way of doing this, but it seems to work...

int main (int argc, const char * argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSLog(@"----->  %s",argv[1]);
NSString *script = [NSString stringWithCString: argv[1]];
NSFileHandle  *fh = [[NSFileHandle alloc] init];
fh = [NSFileHandle fileHandleForReadingAtPath: script];
NSData *inData = [[NSData alloc] init];
inData = [fh readDataToEndOfFile];

NSString *myString = [[NSString alloc] initWithData: inData encoding: NSUTF8StringEncoding];

NSLog(@"\n%@\n", myString);
    [pool release];
    return 0;

this will allow you to create a script with your tool as the executable on the shebang line and then it will read in that script which you'll then have to parse.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]