• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Standard input/output in Objective-C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Standard input/output in Objective-C


  • Subject: Re: Standard input/output in Objective-C
  • From: Nick Zitzmann <email@hidden>
  • Date: Tue, 23 Mar 2010 15:57:57 -0600

On Mar 23, 2010, at 3:44 PM, Mikael Wämundson wrote:

> My first attempt is of course to just use the cin/cout methods by importing iostream.h, but when looking for the header file I find it deeply buried (/Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/IOKit/stream) and I don't succeed in importing it.
> My conclusion from this is: I'm not supposed to use cin/cout in an Objective-C application???

Wrong. You can use C++ in ObjC++ source. The header you are looking for is <iostream> and it is part of the standard set of headers installed somewhere in /usr/include. Ignore the headers in the kernel framework unless you're making a kernel extension, because the kernel framework is only to be used for making kernel extensions. Kernel extensions use a stripped-down version of C++.

To turn an ObjC source file into an ObjC++ source file, change its extension from .m to .mm.

> Feels complicated. My conclusion: I'm making it more complicated than it should be???

If you feel more comfortable using stdout/stdin or cout/cin, then go ahead and use them instead.

Nick Zitzmann
<http://www.chronosnet.com/>

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Standard input/output in Objective-C (From: Mikael Wämundson <email@hidden>)

  • Prev by Date: Re: Standard input/output in Objective-C
  • Next by Date: Re: Standard input/output in Objective-C
  • Previous by thread: Re: Standard input/output in Objective-C
  • Next by thread: Re: Standard input/output in Objective-C
  • Index(es):
    • Date
    • Thread