Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: [Caml-list] using open_out_gen, output_string and close_out
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Johann Spies <jspies@m...>
Subject: Re: [Caml-list] using open_out_gen, output_string and close_out
"Jeremy Fincher" <tweedgeezer@hotmail.com> writes:

> I believe your permissions are wrong.  I can't tell you what
> algorithm to use to determine the permissions number, but I know it
> has to include some bits for the file type (plain file, socket,
> pipe, directory, etc.)
> 
> When I want 0644 I use 33188.  That's all I can tell you.  I found
> that number by looking at the ST_MODE return value of the stat(2)
> call on a regular file that i knew was 0644 :)

I think the following illustrates that the permissions is are not the
problem:

# let l = open_out_gen [Open_creat; Open_append] 33188 "/tmp/xx";;
val l : out_channel = <abstr>
# let skryf = output_string l "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  bbbbbbbbbbbbbbbbbbbbbbbbbbb
  ccccccccccccccccccccccccccc";;
    val skryf : unit = ()
# close_out l;;
Uncaught exception: Sys_error "Bad file descriptor".
#

-rw-r--r--    1 js       js              0 Aug  7 08:27 xx


# let k = open_out_gen [Open_creat; Open_append] 0o644 "/tmp/yy";;
val k : out_channel = <abstr>
# output_string k "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
  bbbbbbbbbbbbbbbbbbbbbbbbbbb
  ccccccccccccccccccccccccccc";;
    - : unit = ()
# close_out k;;
Uncaught exception: Sys_error "Bad file descriptor".

-rw-r--r--    1 js       js              0 Aug  7 08:29 yy



Johann
-- 
Johann Spies          Telefoon: 021-808 4036
Informasietegnologie, Universiteit van Stellenbosch

     "If ye be reproached for the name of Christ, happy are 
      ye; for the spirit of glory and of God resteth upon 
      you; on their part He is spoken evil of, but on your 
      part He is glorified."                 I Peter 4:14 
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr