Reuse, not rework
Home

License Awareness



Highly Reusable Software

By activity
Professions, Sciences, Humanities, Business, ...

User Interface
Text-based, GUI, Audio, Video, Keyboards, Mouse, Images,...

Text Strings
Conversions, tests, processing, manipulation,...

Math
Integer, Floating point, Matrix, Statistics, Boolean, ...

Processing
Algorithms, Memory, Process control, Debugging, ...

Stored Data
Data storage, Integrity, Encryption, Compression, ...

Communications
Networks, protocols, Interprocess, Remote, Client Server, ...

Hard World
Timing, Calendar and Clock, Audio, Video, Printer, Controls...

File System
Management, Filtering, File & Directory access, Viewers, ...


NAME

librock_decodeCBE - Translate C backslash escape sequences in a string.

#License - #Source code - #Example Use -

SYNOPSIS

#include <librock/parse.h>

char *
librock_decodeCBE(
    char *pszBackslashEscaped, /* NUL terminated string */
    int *pcb
);

DESCRIPTION

Walk a string, translating backslash escapes of the forms: \f \t \n \r \b \xXX \\ \0 \0nnn and storing the result in the same buffer. Because of the properties of the encoding, the result will fit.

Other characters which follow a backslash character are stored literally (but the backslash itself is not.)

If (pcb), the number of characters in the translated string is stored at *pcb. (This allows \0 to be used within the string.

Typical use is to allow a parameter (command line or configuration) to specify characters which include special characters.

#ifdef librock_TYPICAL_USE_decodeCBE
    char *ptr = "Try\x20this\040test.\n";
    librock_decodeCBE(ptr,0);
    printf("%s",ptr);
#endif

USES

    librock_sscharbe()

LICENSE

  Copyright 1998-2002 Forrest J. Cavalier III, http://www.mibsoftware.com
  Open-source under MIT license. NO WARRANTY. Copies must retain this block.
  License text in <librock/license/mit.txt> librock_LIDESC_HC=cc598307414a9997b32b60a2e7a8e7c6a13d6438
SEE ALSO
Reference: librock_sscharbe 

Source Code

./text/convert/nonint/decbe.c (implementation, plus source of this manual page)

This software is part of Librock

Rapid reuse, without rework. Details
This page copyright (C) 2002-2004 Forrest J. Cavalier III, d-b-a Mib Software, Saylorsburg PA 18353, USA

Verbatim copying and distribution of this generated page is permitted in any medium provided that no changes are made.
(The source of this manual page may be covered by a more permissive license which allows modifications.)

Want to help? We welcome comments, patches. -- Need help? Request paid support.