Hi Dave,

Thanks for that, just what I was looking for.

Cheers,

Billy.
On 22 Apr 2010, at 11:04, Dave Keck wrote:

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

Billy Flatman
b.flat...@googlemail.com


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to