# LEF 5.8 C/C++ Programming Interface -- 7
Describes the C/C++ programming interface used to read and write Library Exchange Format (LEF) files.
Author: Technical Publications

###
LEF 5.8 C/C++ Programming Interface (Open Licensing Program)

# 7

# LEF Compressed File Routines

The Cadence® Library Exchange Format (LEF) reader provides the following routines for opening and closing compressed LEF files. These routines are used instead of the fopen and fclose routines that are used for regular LEF files.

| lefGZipOpen

| lefGZipClose

| Example

### lefGZipOpen

Opens a compressed LEF file. If the file opens with no errors, this routine returns a pointer to the file.

#### Syntax

lefGZFile lefGZipOpen(
  const char*
gzipFile,
  const char* mode);

#### Arguments

gzipFile

> Specifies the compressed file to open.

mode

> Specifies how to open the file. Compressed files should be opened as read only; therefore, specify "r".

### lefGZipClose

Closes the compressed LEF file. If the file closes with no errors, this routine returns zero.

#### Syntax

int lefGZipClose(
  lefGZFile
filePtr) ;

#### Arguments

filePtr

> Specifies a pointer to the compressed file to close.

### Example

The following example uses the lefGZipOpen and lefGZipClose routines to open and close a compressed file.

lefrInit() ;

for (fileCt = 0; fileCt < numInFile; fileCt++) {

> lefrReset();

> // Open the compressed LEF file for the reader to read

> if ((f = lefGZipOpen(inFile[fileCt], "r")) == 0) {

> fprintf(stderr, "Couldn't open input file '%s'\n", inFile[fileCt]);

> return(2) ;

> }

> (void)lefrEnableReadEncrypted();

> // Initialize the lef writer. Needs to be called first.

> status = lefwInit(fout);

> if (status != LEFW_OK)

> return 1;

> res = lefrRead((FILE*)f, inFile[fileCt], (void*)userData);

> if (res)

> fprintf(stderr, "Reader returns bad status.\n", inFile[fileCt]);

> // Close the compressed LEF file.

> lefGZipClose(f);

> (void)lefrPrintUnusedCallbacks(fout);

}

fclose(fout);

return 0;}

Return to top of page

For support, see Cadence Online Support service.
Copyright © 2016, Cadence Design Systems, Inc.
All rights reserved.