Re: capture console output
Re: capture console output
- Subject: Re: capture console output
- From: Dave Keck <email@hidden>
- Date: Thu, 22 Apr 2010 00:04:18 -1000
> FILE *file = popen("sqlite3 test.db .tables","r");
>
> However, I've not been able to read the information from the returned file.
What exactly isn't working? Maybe this helps:
NSString *fullPathToDatabase = @"/Users/dave/test.db";
NSTask *sqliteTask = [[NSTask alloc] init];
NSPipe *readPipe = [NSPipe pipe];
[sqliteTask setLaunchPath: @"/usr/bin/sqlite3"];
[sqliteTask setArguments: [NSArray arrayWithObjects:
fullPathToDatabase, @".tables", nil]];
[sqliteTask setStandardOutput: readPipe];
[sqliteTask launch];
NSLog(@"sqlite wisdom: %@", [[[NSString alloc] initWithData:
[[readPipe fileHandleForReading] readDataToEndOfFile]
encoding: NSUTF8StringEncoding] autorelease]);
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden