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

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

# 7

# DEF Compressed File Routines

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

| defGZipOpen

| defGZipClose

| Example

### defGZipOpen

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

#### Syntax

defGZFile defGZipOpen(
  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".

### defGZipClose

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

#### Syntax

int defGZipClose(
  defGZFile
filePtr) ;

#### Arguments

filePtr

> Specifies a pointer to the compressed file to close.

### Example

The following example uses the defGZipOpen and defGZipClose routines to open and close a compressed file.

defrInit() ;

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

> defrReset();

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

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

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

> return(2) ;

> }

> // Set case sensitive to 0 to start with, in History and PropertyDefinition

> // reset it to 1.

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

> if (res)

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

> // Close the compressed DEF file.

> defGZipClose(f);

> (void)defrPrintUnusedCallbacks(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.