GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  CMP_FLOAT (3)

NAME

cmp_set_offset, cmp_struct, cmp_char, cmp_short, cmp_int, cmp_long, cmp_float, cmp_double, cmp_long_double, cmp_schar, cmp_uchar, cmp_ushort, cmp_uint, cmp_ulong, cmp_charptr, cmp_chararr - comparison functions for qsort, bsearch, and others

CONTENTS

Synopsis
Author

SYNOPSIS

#include <cmp.h>
void cmp_set_offset(size_t offset, int (*)(const void *, const void *));
int cmp_struct(const void *, const void *);

int cmp_char(const void *, const void *); int cmp_short(const void *, const void *); int cmp_int(const void *, const void *); int cmp_long(const void *, const void *); int cmp_float(const void *, const void *); int cmp_double(const void *, const void *); int cmp_long_double(const void *, const void *);

int cmp_schar(const void *, const void *);

int cmp_uchar(const void *, const void *); int cmp_ushort(const void *, const void *); int cmp_uint(const void *, const void *); int cmp_ulong(const void *, const void *);

int cmp_charptr(const void *, const void *); int cmp_chararr(const void *, const void *);

DESCRIPTION

The functions declared above, with the exception of cmp_set_offset, compare two array elements of the indicated type when given pointers to them. The functions are designed to work with qsort(3), bsearch(3), and a number of other library functions which all need the same type of comparison function. They all return negative if the value indicated by the first argument is less than the second, 0 if they are the same, and positive otherwise.

cmp_struct compares elements of a structure. It needs to know the offset of the element, and a comparison function suitable for the type of the element. These are set with cmp_set_offset, which should be called before qsort(3). The settings stay in effect until changed.

SEE ALSO

publib(3), qsort(3), bsearch(3), isort(3), lsearch(3), lfind(3)

AUTHOR

Lars Wirzenius (lars.wirzenius@helsinki.fi)
Search for    or go to Top of page |  Section 3 |  Main Index


Publib COMPARE (3) C Programmer's Manual

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.