Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let load name = Dir("root", []) ;;
- let rec printloop o l = match l with
- | [] -> ()
- | y::ys -> output_string o (y^"\n"); printloop o ys;;
- let rec store n z =
- let fich = open_out n in
- match z with
- | File(name, y) ->
- output_string fich "f\n"; output_string fich (name^"\n") ; output_binary_int fich (List.length y) ; printloop fich y
- | Dir(name, y::ys) ->
- output_string fich "d\n"; output_string fich (name^"\n") ; output_binary_int fich ((List.length (getSub y))+(List.length ys)) ;
- store n y; store n (Dir(name, ys))
- | _ -> close_out fich;;
Add Comment
Please, Sign In to add comment