[#BloombergLP-bdlb-Print-printString] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlb.adoc[bdlb]::xref:BloombergLP/bdlb/Print.adoc[Print]::printString :relfileprefix: ../../../ :mrdocs: Print a character string to a stream, escaping non‐printables. == Synopsis Declared in `<bdlb_print.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- static std::ostream& printString( std::ostream& stream, char const* string, int length, bool escapeBackSlash = false); ---- == Description Print to the specified `stream` the specified `string` of the specified `length` and return a reference providing modifiable access to `stream`. If the optionally specified `escapeBackSlash` flag is `true`, then all occurrences of the backslash character ('') in the `string` are escaped (i.e., expanded to "\") when written to the `stream`. Note that non‐printable characters in `string` will be printed in their hexadecimal representation ('xHH'). If `stream` is not valid on entry, this operation has no effect. The behavior is undefined unless `0 <= length`. == Return Value a reference to `stream` == Parameters [cols="1,4"] |=== | Name| Description | *stream* | the output stream | *string* | the character string to print | *length* | the length of `string` in bytes | *escapeBackSlash* | whether to escape backslash characters |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#