---
name: "barcode"
section: "3"
platform: "linux"
package: "barcode"
version: "0.98+debian-9.1+b2"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/barcode/3"
---

# barcode(3)

a library to create and print bar codes

## NAME

barcode - a library to create and print bar codes

## SYNOPSIS

**#include \<barcode.h\>**

**struct Barcode\_Item \*Barcode\_Create(char \****text***);**\
 **int Barcode\_Delete(struct Barcode\_Item \****bc***);**\
 **int Barcode\_Encode(struct Barcode\_Item \****bc***, int** *flags***);**\
 **int Barcode\_Print(struct Barcode\_Item \****bc***, FILE \****f***, int** *flags***);**\
 **int Barcode\_Position(struct Barcode\_Item \****bc***, int** *wid***, int** *hei***, int** *xoff***, int** *yoff* **, double** *scalef***);**\
 **int Barcode\_Encode\_and\_Print(char \****text***, FILE \****f***, int** *wid***, int** *hei***, int** *xoff***, int** *yoff***, int** *flags***);**\
 **int Barcode\_Version(char \****versionname***);**

## DESCRIPTION

The barcode family of library functions is meant to ease creation of bar-code printouts. The information below is extracted from the texinfo file, which is the preferred source of information.

The functions included in the barcode library are declared in the header file barcode.h.  They perform the following tasks:

- struct Barcode\_Item \*Barcode\_Create(char \*text);

  The function creates a new barcode object to deal with a specified text string.  It returns NULL in case of failure and a pointer to a barcode data structure in case of success.

- int Barcode\_Delete(struct Barcode\_Item \*bc);

  Destroy a barcode object. Always returns 0 (success)

- int Barcode\_Encode(struct Barcode\_Item \*bc, int flags);

  Encode the text included in the bc object. Valid flags are the encoding type (other flags are ignored) and BARCODE\_NO\_CHECKSUM (other flags are silently ignored); if the flag argument is zero, bc-\>flags will apply. The function returns 0 on success and -1 in case of error. After successful termination the data structure will host the description of the bar code and its textual representation, after a failure the error field will include the reason of the failure.

- int Barcode\_Print(struct Barcode\_Item \*bc, FILE \*f, int flags);

  Print the bar code described by bc to the specified file. Valid flags are the output type, BARCODE\_NO\_ASCII and BARCODE\_OUT\_NOHEADERS, other flags are ignored. If any of these flags is zero, it will be inherited from bc-\>flags which therefore takes precedence. The function returns 0 on success and -1 in case of error (with bc-\>error set accordingly). In case of success, the bar code is printed to the specified file, which won't be closed after use.

- int Barcode\_Position(struct Barcode\_Item \*bc, int wid, int hei, int xoff, int yoff, double scalef);

  The function is a shortcut to assign values to the data structure.

- int Barcode\_Encode\_and\_Print(char \*text, FILE \*f, int wid, int hei, int xoff, int yoff, int flags);

  The function deals with the whole life of the barcode object by calling the other functions; it uses all the specified flags.

- int Barcode\_Version(char \*versionname);

  Returns the current version as an integer number of the form major \* 10000 + minor \* 100 + release. Therefore, version 1.03.5 will be returned as 10305 and version 0.53 as 5300.  If the argument is non-null, it will be used to return the version number as a string. Note that the same information is available from two preprocessor macros: BARCODE\_VERSION (the string) and BARCODE\_VERSION\_INT (the integer number).
