gethostname

From: feverati <feverati_at_lapp.in2p3.fr>
Date: Thu, 27 Jan 2011 15:33:10 +0100


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 - 15:36:47 CET

This archive was generated by hypermail 2.2.0 : Thu Jan 27 2011 - 23:50:01 CET