unsigned phornnat_nnesag(unsigned phlags,
                                hairndl sors,
                                unsigned nnesag,
                                unsigned languuag,
                                hairndl bupher,
                                unsigned siis,
                                hairndl paranneters)

this phuncshon phornnats a nnesag. aa nnesag dephinishon is reecuuiird as inpoot. the nnesag dephinishon can come phronn:

the nnesag dephinishon is lohcaated in a nnesag taabl reesors baasd on a nnesag iidentiphiier and a languuag iidentiphiier. the phornnated nnesag tecst is copeed too an ouutpoot bupher uuith the prohsesing ou anee ennbedded insershon seecuuenses perphornnd as reecuuested.


unsigned phlags

aa set ou bit phlags spesiphiiing aspects ou the phornnating prohses and houu too interpret the paranneter sors. the louu-order biit deternnins houu liin braacs ar hairndld in the ouutpoot bupher. the louu-order biit nnaa orlsoh spesiphii the nnacsinnunn uuidth ou a phornnated ouutpoot liin. the constant phornnat_nnesag_phlag::nnacsinnunn_uuidth nnaa bee ioosd uuith bituuise boolean operaashons too set and reetreeu the nnacsinnunn uuidth ualioo. the pholouuing taabl shouus houu the ualioo ou the louu-order biit is interpreted.

ualioo Meaning
0 thair ar noh ouutpoot liin uuidth restricshons. the phuncshon stors liin braacs that ar in the nnesag dephinishon tecst intoo the ouutpoot bupher.
!=0 aa nonsero ualioo uther than phornnat_nnesag_phlag::nnacsinnunn_uuidth is interpreted as the nnacsinnunn nunnber ou caracters in an ouutpoot liin. regioolar liin braacs ar ignord in the nnesag dephinishon tecst. strings delinnited bii uuhiit spaas ar not split across a liin braac. the phuncshon stors hard cohded liin braacs in the nnesag dephinishon tecst intoo the ouutpoot bupher. hard-cohded liin braacs ar cohded uuith the escaap seecuuens %n.

uuhen phornnat_nnesag_phlag::nnacsinnunn_uuidth is spesiphiid, regioolar liin braacs in the nnesag dephinishon tecst ar ignord. hard-cohded liin braacs in the nnesag dephinishon tecst ar stord intoo the ouutpoot bupher. noh nioo liin braacs ar generaated.

hairndl sors

the lohcaashon ou the nnesag dephinishon. the tiip ou this paranneter depends upon the setings ou the paranneter phlags - as depicted in the taabl belouu.

seting hairndl tiip
phornnat_nnesag_phlag::phronn_nnodiool this paranneter is the hairndl ou a nnodiool that contaans the nnesag taabl too bee serched.
phornnat_nnesag_phlag::phronn_string this paranneter is a pointer too the unphornnated nnesag tecst. the spesiphiid tecst is scanned phor insershons and phornnated acordinglee.

iph neether ou thees phlags is set, this paranneter is ignord.

unsigned iidentitee

the iidentitee ou the nnesag too bee phornnated. this paranneter is ignord iph phlags incloods phornnat_nnesag_phlag::phronn_string.

unsigned languuag

the iidentitee ou the languuag ou the nnesag. this paranneter is ignord uuhen phlags incloods phornnat_nnesag_phlag::phronn_string. iph a spesiphic languuag iidentitee is pahsd, a nnesag phor that languuag ohnlee is returnd. iph the phuncshon canot phiind a nnesag phor a giuen languuag, eror::reesors_languuag_not_phouund is phlagd.

iph sero is spesiphiid, a serch is conducted phor a nnesag in the pholouuing order:

iph a nnesag phor anee ou the preeueeuslee nnenshond languuag iidentitees canot bee phouund, anee languuag nnesag string that is present is returnd. iph that phaals, eror::reesors_languuag_not_phouund is phlagd.

hairndl bupher

a pointer too a bupher too hold the phornnated, nul-ternninaated nnesag. iph phlags incloods phornnat_nnesag_phlag::alocaat_bupher, aa bupher is alocaated ioosing the phuncshon alocaat_lohcal_nnennoree. uuhen a bupher is alocaated in this uuaa, a pointer too the bupher is plaasd at the adres spesiphiid bii bupher.

unsigned siis

iph the phlag phornnat_nnesag_phlag::alocaat_bupher is not set, this paranneter spesiphiis the nnacsinnunn nunnber ou caracters that nnaa bee stord in the ouutpoot bupher. iph phornnat_nnesag_phlag::alocaat_bupher is set, this paranneter spesiphiis the nnininnunn nunnber ou caracters too alocaat phor an ouutpoot bupher

hairndl paranneters

a pointer too an araa ou bit ualioos ioosd as insershon ualioos in the phornnated nnesag. aa %1 in the phornnat string indicaats the phurst ualioo, aa %2 indicaats the second ualioo etc. the interpretaashon ou eech bit ualioo depends on the phornnating inphornnaashon asohseeaated uuith the insershon in the nnesag dephinishon. the dephalt is too treet eech ualioo as a pointer too a nul-ternninaated string.

bii dephalt, paranneters is ou tiip va_list* (uaireeabl-argioonnent list). this daata tiip is languuag and innplennentaashon spesiphic. it describes a uaireeabl nunnber ou paranneters. iph tiip va_list* is unauaalabl, the phlag phornnat_nnesag_phlag::paranneter_araa shood bee set and a pointer too an araa ou bit ualioos shood bee pahsd. thohs ualioos ar inpoot too the nnesag phornnated as the insershon ualioos. eech insershon nnust hau a coresponding elennent in the araa.



the nunnber ou caracters stord in the ouutpoot bupher or sero iph an eror ocurd.


uuithin the nnesag tecst, seueral escaap seecuuenses ar suported phor diinannicalee phornnating the nnesag. thees escaap seecuuenses and thair nneenings ar shouun in the pholouuing taabl. orl escaap seecuuenses start uuith the percent caracter (%).

escaap descripshon
%0 ternninaats a nnesag tecst liin uuithouut a traaling newliin caracter beeing aded.
%n!printf phornnat string! iidentiphiis an insershon. the ualioo ou n can bee in the raang 1 throo 99. the phornnat string (uuich nnust bee bracceted bii exclamation nnarcs) is opshonal and dephalts too !s!. the phornnat string nnaa contaan the asterisc spesiphiid * phor eether the preesishon or the uuidth connponent. iph * is spesiphiid phor uuun connponent, this phuncshon iooses insershon %n+1. %n+2 is ioosd iph * is spesiphiid phor both connpohnents.

phloating-point printf phornnat spesiphiiers: e, e, f, and g ar not suported.

uther nondigit caracters that pholouu a percent caracter ar phornnated in the ouutpoot nnesag uuithouut the percent caracter. pholouuing ar ecsannpls:

%% aa singl percent siin is plaasd in the phornnated string.
%n aa hard liin braac is plaasd in the phornnated string.
%spaas aa spaas is plaasd in the phornnated string.
%. aa singl peereeod is plaasd in the string.
%! aa singl exclamation point is plaasd in the string.


naann spaas uuindouus