Browse Source

binary optional (default=true)

Nicolas Cannasse 13 years ago
parent
commit
0831f40b0a
2 changed files with 6 additions and 6 deletions
  1. 3 3
      std/cpp/io/File.hx
  2. 3 3
      std/php/io/File.hx

+ 3 - 3
std/cpp/io/File.hx

@@ -47,15 +47,15 @@ class File {
 		return haxe.io.Bytes.ofData(data);
 	}
 
-	public static function read( path : String, binary : Bool ) {
+	public static function read( path : String, binary : Bool = true ) {
 		return new FileInput(file_open(path,(if( binary ) "rb" else "r")));
 	}
 
-	public static function write( path : String, binary : Bool ) {
+	public static function write( path : String, binary : Bool = true ) {
 		return new FileOutput(file_open(path,(if( binary ) "wb" else "w")));
 	}
 
-	public static function append( path : String, binary : Bool ) {
+	public static function append( path : String, binary : Bool = true ) {
 		return new FileOutput(file_open(path,(if( binary ) "ab" else "a")));
 	}
 

+ 3 - 3
std/php/io/File.hx

@@ -50,15 +50,15 @@ class File {
 		return untyped __call__("file_put_contents", path, content);
 	}
 
-	public static function read( path : String, binary : Bool ) {
+	public static function read( path : String, binary : Bool = true ) {
 		return new FileInput(untyped __call__('fopen', path, binary ? "rb" : "r"));
 	}
 
-	public static function write( path : String, binary : Bool ) {
+	public static function write( path : String, binary : Bool = true ) {
 		return new FileOutput(untyped __call__('fopen', path, binary ? "wb" : "w"));
 	}
 
-	public static function append( path : String, binary : Bool ) {
+	public static function append( path : String, binary : Bool = true ) {
 		return new FileOutput(untyped __call__('fopen', path, binary ? "ab" : "a"));
 	}