Skip to content

Instantly share code, notes, and snippets.

@coryalder
Created January 16, 2015 21:47
Show Gist options
  • Save coryalder/ab00fe7e1d8e22813c50 to your computer and use it in GitHub Desktop.
Save coryalder/ab00fe7e1d8e22813c50 to your computer and use it in GitHub Desktop.
scanf -> fgets
char str[100];
fgets (str, 100, stdin);
NSString *inputString = [[NSString alloc] initWithUTF8String:str];
inputString = [inputString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
NSLog(@"Input was %@", inputString);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment