Ejemplo n.º 1
0
	value lime_byte_array_read_file (value inFilename) {
		
		ByteArray result = ByteArray (val_os_string(inFilename));
		
		return result.mValue;
		
	}
Ejemplo n.º 2
0
	value lime_byte_array_overwrite_file (value inFilename, value inBytes) {
		
		// file is created if it doesn't exist,
		// if it exists, it is truncated to zero
		FILE_HANDLE *file = lime::fopen (val_os_string (inFilename), "wb");
		
		if (!file) {
			
			#ifdef ANDROID
			// [todo]
			#endif
			return alloc_null();
			
		}
		
		ByteArray array (inBytes);
		
		// The function fwrite() writes nitems objects, each size bytes long, to the
		// stream pointed to by stream, obtaining them from the location given by
		// ptr.
		// fwrite(const void *restrict ptr, size_t size, size_t nitems, FILE *restrict stream);
		lime::fwrite (array.Bytes (), 1, array.Size (), file);
		
		lime::fclose (file);
		return alloc_null ();
		
	}
Ejemplo n.º 3
0
    value snow_byte_array_read_file(value inFilename) {

        ByteArray result = ByteArray::FromFile(val_os_string(inFilename));

        return result.mValue;

    } DEFINE_PRIM(snow_byte_array_read_file,1);
Ejemplo n.º 4
0
    value snow_byte_array_overwrite_file(value inFilename, value inBytes) {

        ByteArray::ToFile(val_os_string(inFilename), ByteArray(inBytes));

        return alloc_null();

    } DEFINE_PRIM(snow_byte_array_overwrite_file, 2);
Ejemplo n.º 5
0
	value lime_bytes_read_file (value path) {
		
		Bytes data = Bytes (val_os_string (path));
		return data.Value ();
		
	}