Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Replacement for Console.WriteLine?

Reply
Thread Tools

Replacement for Console.WriteLine?

 
 
Ramon F Herrera
Guest
Posts: n/a
 
      03-06-2008

I am an experienced C developer, but also a newbie in C++.

I am trying to compile and run the following code snippet on Linux:

FieldIterator itr = doc.GetFieldIterator();

while (itr.HasNext()) {
Field field = itr.Current();
Console.WriteLine("Field name: {0}", field.GetName());
itr.Next();
}

Since my g++ compiler doesn't like the "Console.WriteLine()"
statement, I googled for it, and it seems to be some Windows-specific
construct. What can I use as a replacement? Obviously, I tried
"printf()" but the argument is not a string.

TIA,

-RFH


 
Reply With Quote
 
 
 
 
Christopher
Guest
Posts: n/a
 
      03-06-2008
On Mar 6, 3:55 pm, Ramon F Herrera <(E-Mail Removed)> wrote:
> I am an experienced C developer, but also a newbie in C++.
>
> I am trying to compile and run the following code snippet on Linux:
>
> FieldIterator itr = doc.GetFieldIterator();
>
> while (itr.HasNext()) {
> Field field = itr.Current();
> Console.WriteLine("Field name: {0}", field.GetName());
> itr.Next();
> }
>
> Since my g++ compiler doesn't like the "Console.WriteLine()"
> statement, I googled for it, and it seems to be some Windows-specific
> construct. What can I use as a replacement? Obviously, I tried
> "printf()" but the argument is not a string.
>
> TIA,
>
> -RFH


I don't knwo what your "Field" or "doc" is, but it looks to me like
you have .NET code there, not C++.
To display something to the console, or more specifically to the
standard out stream, use std::cout.
You will have quite the time converting .NET to C++ on a Linux
platform.

#include <iostream>

int main()
{
std::cout << "Hello World!";
return 0;
}

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Replacement PSU for an ADSL Router Edward W. Thompson Wireless Networking 0 09-06-2005 10:40 AM
Replacement for FF calendar extension Dan Firefox 5 03-23-2005 08:38 PM
Replacement for AOL newsgroup access EJGroth Firefox 0 02-08-2005 02:41 PM
Calendar replacement William W. Plummer Firefox 1 07-02-2004 04:10 PM
Replacement For Access Point KS Wireless Networking 1 06-24-2004 04:40 AM



Advertisments