---
name: "ms_blktlen"
section: "3"
platform: "linux"
package: "libmseed-doc"
version: "2.19.8-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/ms_blktlen"
---

# ms\_blktlen(3)

Look up libmseed and Mini-SEED related information

## NAME

ms\_lookup - Look up libmseed and Mini-SEED related information

## SYNOPSIS

```
#include <libmseed.h>
char    *ms_errorstr ( int errorcode );
uint8_t  ms_samplesize ( const char sampletype );
char    *ms_encodingstr ( const char encoding );
char    *ms_blktdesc ( uint16_t blkttype );
uint16_t ms_blktlen ( uint16_t blkttype, const char *blktdata,
                      flag swapflag );
```

## DESCRIPTION

**ms\_errorstr** returns a pointer to a string describing the specified libmseed error code.  The error codes are defined in libmseed.h and returned by various functions.

**ms\_samplesize** returns the sample size based on the specified *sampletype*.  In general libmseed uses the following character sample types:

```
"a" = 1 byte (ASCII)
"i" = 4 bytes (integer)
"f" = 4 bytes (float)
"d" = 8 bytes (double)
```

**ms\_encoding** returns a pointer to a string describing the specified data *encoding* format.  If the encoding format is unknown an appropriate string is return stating just that.

**ms\_blktdesc** returns a pointer to a string describing the specified blockette type (*blkttype*).  If the blockette type is unknown NULL is returned.

**ms\_blktlen** returns the total length of the specified blockette type (*blkttype*) in bytes.  A pointer to the blockette itself (*blkt*) should also be provided along with a *swapflag* that should be set to 1 when the blockette is known to have a different byte order than the host computer.  The length returned includes both the blockette "header" (type and next fields) and "body".

Technically a pointer to blockette and the swapflag only need to be supplied when the blockette type is a variable length blockette and the length is contained within the blockette itself (e.g. blockette type 2000).  For blockettes of known fixed length (most of them) the *blkt* pointer and *swapflag* are not used.

In the case of blockette type 405 that is variable length and not self describing 0 will be returned.  In the case of blockette type 2000 that is variable length and self describing the length will be read from a known offset into the blockette data.

## RETURN VALUES

**ms\_errorstr** returns a pointer to a static string.

**ms\_samplesize** returns the sample size in bytes or 0 for unknown sample type.

**ms\_encoding** returns a pointer to a static string.

**ms\_blktdesc** returns a pointer to a static string or NULL if the blockette type is unknown.

**ms\_blktlen** returns the total length of the specified blockette type or 0 for unknown type.

## AUTHOR

```
Chad Trabant
IRIS Data Management Center
```
