Comma-separated input?

For a little assignment that I'm doing, my program is expecting a list of five comma-separated numbers (3 floats) in one line of input. How can I read all those integers into five separate ivars? I've already copied the entire input string into another NSString to "work on" via


acceptedInput = [input stringValue];


where acceptedInput is an NSString and input is an NSTextField.

I vaguely remember how to do something like this in plain C with scanf(), but I'm not sure if scanf() works with NSString objects. Is there an equivalent, or another way to do this?

iMac 8,1 stock—OS .VI.II • iPod Touch 1,1—OS 3.1.2, D-link DIR-625 router • iLife 09 • iWork 09 • XCode 3.2.1 (64-bit)

Posted on Mar 18, 2010 5:53 PM

Reply
16 replies

Mar 26, 2010 2:50 AM in response to musicwind95

musicwind95 wrote:
The icon is not changing, even though I've added the image and set it in the .plist.

OS X apps like .icns files. For best results, follow the instructions under [Create an Icon File|http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjC Tutorial/08Configuring/08Configuring.html#//apple_ref/doc/uid/TP40000863-CH10-SW 16] in +Cocoa Application Tutorial+. Be sure not to skip step 5 under "To add the icon to the project:". When you enter the icon file name in Target Info->Properties, Info.plist will be populated correctly (It might be best to start with a blank value for the Icon file key in that plist).
How would I know if the class name is already taken?

Normally you should get a compiler error if one of your class names conflicts with another class name or some other type identifier.
Is there a global class-name search function in XCode?

Well Xcode will search for identifiers of many kinds (see [Searching in a Project|https://developer.apple.com/mac/library/documentation/DeveloperTools/Co nceptual/XcodeProjectManagement/150-Searching Files_and_Projects/searching_files_and_projects.html#//appleref/doc/uid/TP40002669-BABFCHDJ] in the +Xcode Project Management Guide+, but it's essential for the compiler to rule out an ambiguous class name, so that search is done automatically as part of the build.

To be clear on this point, the problem you experienced with 'Zone' should never have occurred without a compiler warning. If you're interested in pursuing this, try to build the smallest possible project which will exhibit the problem, then either file a bug yourself or post that code in a new topic here and maybe also in the [Apple Mailing Lists|http://lists.apple.com>. Either Eric Meyers or Mark Szymczyk could probably tell you why there was no warning and whether a bug should be filed.
What does 64-bit have to do with it?

Referring to the excerpt from MacMemory.h in my last post, the Zone type declared in that file is switched out when _LP64_ is defined. That macro is one of the switches used to make the SDK support 64-bit operation. Therefore I assume the declaration I posted wasn't seen by your compiler. Yet your results were consistent with an ambiguous identifier. Could there, for example, be a missing _LP64_ switch in an implementation file? I suggested changing the name of that class, not because I knew what was going on, but because I assumed you were in a 64-bit environment, and here was a 64-bit compiler switch that was controlling the visibility of something that could explain the problem. Does that make sense?

I think I"ve covered everything you asked except for the question about Shark. If it doesn't startup and analyze your code as advertised, I guess we can assume it's not installed correctly or not installed at all. Maybe another thread on that topic would find someone with direct experience.

\- Ray

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Comma-separated input?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.