Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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) ? 

ex:
-----------
let main () =
  try
      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 ?

:)
p

-- 
++ 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