discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scanf does not properly pass characters


From: igorland
Subject: scanf does not properly pass characters
Date: Sat, 25 Jan 2014 06:46:17 -0800 (PST)

Hello, World!

I have some experience with Java and C++. I have now decided to try out
Objective C. And from the very beginning, I have the following issue.

Code:

[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("%c", &nameC);
        NSLog(@"Name is: %c", nameC);
        [pool drain];
        return 0;
    }
[/code]

And this is what I get:

<http://gnustep.8.n7.nabble.com/file/n36651/objc.jpg> 

Tried unichar, same thing. Does anyone know what is going on?

P.S. Use Windows 8.1, code with Notepad++.

Thank you!



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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]