Re: gethostname

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Thu, 27 Jan 2011 13:17:01 -0600


Hi,

gethostname is not expose to CINT. You can either compile your code or use the platform independent gSystem->HostName()

Cheers,
Philippe.

On 1/27/11 8:33 AM, feverati wrote:
> Hi
>
> I'm trying to run the following vary basic c/c++ piece of code
> within root 5.24/00 on a linux machine x86_64
>
> {
> #include "unistd.h"
> using namespace std;
> char *nome; nome=(char *)malloc(sizeof(char)*11);
> gethostname(nome, 10);
> nome[10]='\0';
> cout<<nome<<endl;
> }
>
>
> and I get the following error
>
> Error: Function gethostname(nome,10) is not defined in current scope
> *** Interpreter error recovered ***
>
> The function gethostname is defined in unistd.h so the code should work properly. Where am I wrong?
>
> Giovanni F.
>
Received on Thu Jan 27 2011 - 20:17:12 CET

This archive was generated by hypermail 2.2.0 : Fri Jan 28 2011 - 11:50:01 CET