Scroll Down to See All
abortabsacosasctimeasctime_rasinassertatanatan2atexitatofatoiatolbsearchbtowccalloccatclosecatopenceilclearerrclockcoscoshctimectime_rdifftimediverferfcexitexpfabsfclosefdopenfeofferrorfflushfgetcfgetposfgetsfgetwcfgetwsfopenfprintffputcfputwsfreadfreefreopenfrexpfscanffseekfsetposftellfwidefwprintffwritefwscanfgetcgetchargetenvgetwcgetwchargmtimegmtime_rhypotisalnumisalphaisasciiisblankiscntrlisdigitisgraphislowerisprintispunctisspaceisupperiswalnumiswalphaiswblankiswcntrliswctypeiswdigitiswgraphiswloweriswprintiswpunctiswspaceiswupperiswxdigitisxdigitj0j1jnlabsldexpldivlocaleconvlocaltimelocaltime_rloglog10longjmpmallocmblenmbrlenmbrtowcmbsinitmbsrtowcsmbstowcsmbtowcmemchrmemcmpmemcpymemmovememsetmktimemodfnextafternextafterlnexttowardnexttowardlnl_langinfoperrorpowprintfputcputcharputenvputsputwcputwcharqsortquantexpd32quantexpd64quantexpd128quantized32quantized64quantized128samequantumd32raiserandrand_rreallocregcompregerrorregexecregfreeremoverenamerewindscanfsetbufsetjmpsetlocalesetvbufsignalsinsinhsnprintfsprintfsqrtsrandsscanfstrcasecmpstrcatstrchrstrcmpstrcollstrcpystrcspnstrerrorstrfmonstrftimestrlenstrncasecmpstrncatstrncmpstrncpystrpbrkstrptimestrrchrstrspnstrstrstrtodstrtod32strtod64strtod128strtofstrtokstrtok_rstrtolstrtoldstrtoulstrxfrmswprintfswscanfsystemtantanhtimetime64tmpfiletmpnamtoasciitolowertouppertowctranstowlowertowupperungetcungetwcva_argva_copyva_endva_startvfprintfvfscanfvfwprintfvfwscanfvprintfvscanfvsprintfvsnprintfvsscanfvswprintfvswscanfvwprintfvwscanfwcrtombwcscatwcschrwcscmpwcscollwcscpywcscpywcsftimewcslenwcsncatwcsncmpwcsncpywcspbrkwcsptimewcsrchrwcsrtombswcsspnwcsstrwcstodwcstod32wcstod64wcstod128wcstofwcstokwcstolwcstoldwcstombswcstoulwcsxfrmwctobwctombwctranswctypewcwidthwmemchrwmemcmpwmemcpywmemmovewmemsetwprintfwscanfy0y1yn



Function Details : catgets

char *catgets(nl_catd catalog,int set_id,int msg_id,const char * default_msg) ;

Return Type : char *

String pointer (array of characters)
Read about return values of catgets function .

1st Parameter Type : nl_catd

A data type representing a message catalog descriptor, used to identify and access message catalogs in functions like `catopen`, `catgets`, and `catclose`.

1st Parameter

Message catalog descriptor obtained from `catopen`

2nd Parameter Type : int

Integer type (typically 4 bytes, -2,147,483,648 to 2,147,483,647)

2nd Parameter

Identifier for the message set in the catalog

3rd Parameter Type : int

Integer type (typically 4 bytes, -2,147,483,648 to 2,147,483,647)

3rd Parameter

Identifier for the specific message within the set

4th Parameter Type : const char *

Pointer to read-only string

4th Parameter

Default message returned if the specified message cannot be found

Read more about parameters of catgets in parameters section
The catgetsfunction in C language Reads a string from a message catalog.
The catgets function retrieves a message string from an open message catalog. It attempts to retrieve the message corresponding to set_id and msg_id from the message catalog referenced by catd. If the message is found, catgets returns a pointer to the message string. If the message is not found, it returns a pointer to s.
The catgetsfunction takes 4 parameters:
  • nl_catd `catalog`: Message catalog descriptor obtained from `catopen`
  • int `set_id`: Identifier for the message set in the catalog
  • int `msg_id`: Identifier for the specific message within the set
  • const char * `default_msg`: Default message returned if the specified message cannot be found
Retrieves a message string from a message catalog. If the specified message is not found, the `default_msg` is returned.
The catgets function return value :
  • Returns a pointer to the message string if found, or a pointer to s if the message is not found

Output

This example demonstrates the basic usage of `catgets` to retrieve a message from a catalog. If the message is not found, it will return the default message.