title: How does one turn a scanf result into a NSString and then turn into a property of a class?
body: <p>I need to take a scanf result and turn it into a NSString, and then the NSString into a property of instance pea1 of class Pea.
  It would also be nice if I could put some kind of limit on the scanf so users didn't put too many characters in and stop the program, but this isn't absolutely necessary.</p>
  
  <p>I've spent all of my freetime (six hours) trying to find this over the internet, but it doesn't work. There were a lot of results for either turning a scanf into a NSString or a NSString into a property of a class instance, but I couldn't find both and combining them didn't work.</p>
  
  <p>I need this so that users can name a pea through scanf, and then have that pea's name be displayed.</p>
  
  <p>Here's my code, with everything that doesn't effect this problem taken out:</p>
  
  <pre><code>   #import &lt;Foundation/Foundation.h&gt;
  
     @interface Pea: NSObject
  
     @property (retain) NSString *name;
  
     @end
  
     @implementation Pea
  
     @synthesize name;
  
     @end
  
     int main (int agrc, char * argv[])
  
     {
         @autoreleasepool {
             Pea *pea1 = [[Pea alloc] init];
  
             char word;
  
             //Asks for name of Pea
             NSLog(@"What would you like to name this pea?");
             scanf("%s", &amp;word);
  
             NSString* userInput = [[NSString alloc] initWithUTF8String: &amp;word];
             [pea1 setName: userInput];
  
             //NSLogs data
             NSLog (@"Your pea plant, %@\n.", [pea1 name]);
  
         }
         return 0;
      }
  </code></pre>
  
  <p>Thank you so much for any help you may have! :D</p>