Replacement for Console.WriteLine?

  • Thread starter Ramon F Herrera
  • Start date
R

Ramon F Herrera

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
 
C

Christopher

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;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top