NSString problems.
NSString problems.
- Subject: NSString problems.
- From: email@hidden
- Date: Wed, 11 Feb 2004 02:21:10 EST
After reading all about NSStrings I thought this would work however it give
eroneous characters with the setStringValue in doFind and it's not clear to me
what the problem is.
code:
_______________________________________________
static CFStringRef deviceNameAsCFString;
static NSString *foundDevName;
_______________________________________________
void DeviceAdded(void *refCon, io_iterator_t iterator)
{
kern_return_t kr;
io_service_t usbDevice;
IOCFPlugInInterface **plugInInterface=NULL;
SInt32 score;
HRESULT res;
while (usbDevice = IOIteratorNext(iterator))
{
io_name_t deviceName;
// Get the USB device's name.
kr = IORegistryEntryGetName(usbDevice, deviceName);
printf ("%s ...\n",deviceName); // printws to console
foundDevName = (NSString *)deviceName; // need to use deviceName later
}
return;
}
- (IBAction)doFind:(id)sender
{
[textField setStringValue: @"Looking for devices"];
if (isDevicePresent)
{
[actionButton setTitle:@"Dump Device"];
[actionButton setAction:@selector(doDump:)];
[textField setStringValue:[NSString stringWithFormat:@"Found %s",
foundDevName]]; // ???????
}
else
{
[textField setStringValue: @"Couldn't Find Device"];
}
return;
}
_______________________________________________
What did I miss????
Mr. Dale Walsh
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.