I try to scan a string and divide it to separate strings. My code is:
#import <Foundation/Foundation.h>
NSArray *wordsArray;
int amount;
char input[80];
int main (int argc, const char * argv[])
{
    @autoreleasepool {
       NSString *stra=[[NSString alloc] initWithString:@""];        
    //  stra=@"this is my sentence";
       NSLog(@"Please Enter a sentence!");
       scanf("%s",&input);
       stra=[NSString stringWithCString:input encoding:NSASCIIStringEncoding];
    //   NSLog(@"words: %@",str);
         wordsArray = [stra componentsSeparatedByString:@" "];
         amount= [wordsArray count];
         NSLog(@"Number of Shows : %d", amount);
        for (int i=0; i<amount; i++) 
        {
            NSString *subString = [wordsArray objectAtIndex:i];
            NSLog(@"\n %@",[subString uppercaseString]);
        }
    }
    return 0;
}
On input: "Test1 test2 test3"
I get: Test1
The code doesn't consider spaces. How do i scan the hall string?
 
     
     
    