Truxton artifact get length
Jump to navigation
Jump to search
This tells you the number of raw bytes that make up the artifact.
This may not match the length of the string representation of the artifact value.
For example, the artifact may be three emoticons but the length of the raw bytes could be 12 if the raw bytes are UTF-8 encoded.
This information comes from the [Length] column of the [Entity] table in the database.
Syntax
uint64_t truxton_artifact_get_length(uint64_t artifact_handle);
Parameters
artifact_handle
The artifact instance.
This handle comes from calling truxton_artifact_create().
Return value
The number of bytes in the raw artifact.
Sample
void create_artifact(void)
{
uint64_t truxton = truxton_create();
uint64_t artifact = truxton_artifact_create(truxton);
truxton_artifact_set_name( artifact, "Ducky Momo Server" );
truxton_artifact_set_length( artifact, 42 );
truxton_artifact_save( artifact);
truxton_artifact_tag( artifact, "Too Young", "Yes, yes I am", 1 );
uint64_t length = truxton_artifact_get_length( artifact );
printf( "Artifact raw length is%" PRIu64 "\n", length );
truxton_artifact_destroy(artifact);
truxton_destroy(truxton);
}