English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
getlogin : no such file or directory ??
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-04-12 (08:50)
From: Pietro Abate <Pietro.Abate@a...>
Subject: getlogin : no such file or directory ??
Hi all,
why the Unix.getlogin function returns "no such file or directory"
if the unix getlogin() function returns null (see getlogin.c) ? 

let main () =
      print_string (Unix.getlogin())
  with Unix.Unix_error(e,_,_) ->
      failwith (Unix.error_message e)

main ()

echo "a" | ./a.out
Fatal error: exception Failure(No such file or directory")

How can I use getlogin if I want to pass something on the standard input
to my program ? 

The same example works with MacOsX. Why this difference ?


++ Blog: http://blog.rsise.anu.edu.au/?q=pietro
++ "All great truths begin as blasphemies." -George Bernard Shaw
++ Please avoid sending me Word or PowerPoint attachments.
   See http://www.fsf.org/philosophy/no-word-attachments.html