updf_create_fileΒΆ
updf_create_file creates a new updf file.
- stg = updf_create_file(name)
- stg = updf_create_file(name, mode)
Return Value
stg is a new storage object of an error object (see error_create).
Parameters
- name
name is the name of a updf file. If the name is set to
:memory:
the file will be saved in memory.
- mode
mode is one of the following values:
UPDF_FAIL_IF_EXIST
If the file already exists the file will be not overwritten, instead an error-object will be returned.
UPDF_REPACKING
If storages, streams or attribute are deleted the file will shrink in size. If this flag is not set the space will be used for new objects.
UPDF_ZLIB_COMPRESSION
Improved compression with lower performance.
UPDF_LZ4_COMPRESSION
Fast compression, see https://code.google.com/p/lz4/.
Example
def test_updf_create_file()
{
ssFile = GetTempPath() + "test.updf";
stg = updf_create_file(ssFile);
if (type(stg) != "xStg") {
error();
}
f = updf_create_stream(stg, " test 1");
if (type(f) != "xFile") {
error();
}
fprintf(f, "%s", "This is a text written in Stream 'test 1'.");
fclose(f);
f = updf_create_stream(stg, "test 2");
if (type(f) != "xFile") {
error();
}
fprintf(f, "%s", "This is a text written in Stream 'test 2'.");
fclose(f);
updf_close_storage(stg);
}
test_updf_create_file();
History
Version |
Description |
---|---|
R2013.9 |
|
R2013.5 |
name can be set to |
5.6.0 |
New |
See also
id-1891360