Re: gethostname

From: feverati <feverati_at_lapp.in2p3.fr>
Date: Fri, 28 Jan 2011 10:58:26 +0100


Thank you: gSystem is helpful for me.
By the way: what do you mean that gethostname is not exposed to CINT? Do you mean that some libraries of C/C++ cannot be used within CINT?

Cheers,

Giovanni

On 01/27/2011 08:17 PM, Philippe Canal wrote:
> 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 Fri Jan 28 2011 - 11:02:02 CET

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