Well this seems to work for everything but floats, I've tried this to fix the float issue but it didn't work. case 'f': case 'g': { double floatValue = va_arg(ap, double); size += sizeof(floatValue); ap2 = realloc(ap2, size); ap2[count] = (void *)&floatValue; break; }
Here is the current code. va_list ap, *ap2; size_t size = 0; ap2 = malloc(size); int count = 0; va_start(ap, format); if (format==nil) return; NSString *currentFormat = format; NSRange range = [currentFormat rangeOfString:@"%"]; while (range.location!=NSNotFound) { unichar character = [currentFormat characterAtIndex:range.location+1]; NSLog(@"%C", character); switch (character) { case '@': { id object = [self quoteObject:va_arg(ap, id)]; size += sizeof(object); ap2 = realloc(ap2, size); ap2[count] = (void *)object; break; } case 's': { const char *string = [self quoteChar:va_arg(ap, const char *)]; size += sizeof(string); ap2 = realloc(ap2, size); ap2[count] = (void *)string; break; } default: { id object = va_arg(ap, id); size += sizeof(object); ap2 = realloc(ap2, size); ap2[count] = (void *)object; break; } } count++; currentFormat = [currentFormat substringWithRange:NSMakeRange(range.location+2, [currentFormat length]-(range.location+2))]; range = [currentFormat rangeOfString:@"%"]; } NSString *theQuery = [[[NSString alloc] initWithFormat:format arguments:(va_list)ap2] autorelease]; va_end(ap); free(ap2); Any ideas on how to fix floats? This group seems to be less helpful now, it may just be that I am getting to much harder things than before. Thanks, Mr. Gecko_______________________________________________ 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