catgets.3int

来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 3INT 代码 · 共 89 行

3INT
89
字号
.TH catgets 3int.SH Namecatgets \- read a program message.SH Syntax.B #include <nl_types.h>.PP.B char *catgets (\fIcatd, set_num, msg_num, s\fP).br.B nl_catd \fIcatd\fP;.br.B int \fIset_num, msg_num\fP;.br.B char *\fIs\fP;.SH Description.NXR "catgets subroutine"The function.PN catgetsattempts to read message .I msg_numin set .I set_num from the message catalog identified by .I catd. The parameter .I catd  is a catalog descriptor returned from an earlier call to.PN catopen .The pointer, \fIs\fP, points to a default message string.The.PN catgetsfunction returns the default message if the identified message catalogis not currently available..PPThe.PN catgetsfunction stores the message text it returns in an internal bufferarea.  This buffer area might be written over by a subsequent call to.PN catgets .If you want to re-use or modify the message text, you should copy it to another location..PPThe arguments .I set_numand .I msg_numare defined as integer values to make programs that contain the .PN catgetscall portable.  Where possible, you should use symbolic names for message and set numbers, instead of hard-coding integer values into your source programs.If you use symbolic names, you must include the header file that .PN gencat .PN &\-hcreates in all your program modules..SH ExamplesThe following example shows using the .PN catgetscall to retrieve a message from a message catalog that uses symbolicnames for set and message numbers:.EXnl_catd catd = catopen (messages.msf, 0)message = catgets (catd, error_set, bad_value, "Invalid value").EEWhen this call executes, .PN catgetssearches for the message catalog identified by the catalog descriptorstored in.PN catd .The function searches for the message identified by the .PN bad_valuesymbolic name in the set identified by the.PN error_setsymbolic name and stores the message text in.PN message .If .PN catgetscannot find the message, it returns the message Invalid value..SH Return ValuesIf .PN catgetssuccessfully retrieves the message, it returns a pointer to an internal buffer area containing the null terminated message string.If the call is unsuccessful for any reason,.I catgetsreturns the default message in \fIs\fP..SH See Alsointro(3int), gencat(1int), catgetmsg(3int), catopen(3int), nl_types(5int).br.I Guide to Developing International Software

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?