Markus. Thank you! I have noticed now. Then I faced another issue: converting
the C string to NSString.

Code:

// First program

#import <Foundation/Foundation.h>

int main (int argc, const char* argv[])
{
        NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];

        char nameC[50];
        NSLog(@"ENter your name: ");
        scanf("%s", &nameC);
        NSString* nameS = [NSString stringWithCString:nameC
encoding:NSUTF8StringEncoding];
        NSLog(@"Character Name is: %s", nameC);
        NSLog(@"NSString Name is: %s", nameS);

        [pool drain];
        return 0;
}

Result:

<http://gnustep.8.n7.nabble.com/file/n36653/objc1.jpg> 

Thanks a lot!



--
View this message in context: 
http://gnustep.8.n7.nabble.com/scanf-does-not-properly-pass-characters-tp36651p36653.html
Sent from the GNUstep - General mailing list archive at Nabble.com.

_______________________________________________
Discuss-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to