Oppolzer - Informatik / Blog


Blog-Hauptseite      Neuester Artikel      Älterer Artikel      Neuerer Artikel      Älterer gleiche Kategorie      Neuerer gleiche Kategorie

IBM-MAIN - Initialisierung von Stringkonstanten in C

Subject:

Re: C Language: non-EBCDIC characters in literal strings.

From:

Bernd Oppolzer <bernd.oppolzer@T-ONLINE.DE>

Reply-To:

IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU>

Date:

2014.11.03 16:48:47


Given the limitations of C and its macro language,
it is hard ... if not impossible ... to do such initializations
with const chars at compile time using the features of the
macro language.

It's of course easy to build macros like the ones I did
for string assignment, which, for example, assign strings
with respect to the length of the target buffer, fill strings with
blanks etc. (if the sending field is shorter) and so on ...
all by using C macro language and clever use of
memcpy et. al.

You can, while assigning strings using such functions,
do any code conversion you want, using simple
table driven translations or other conversion routines
like, for example, iconv ().

HTH,
kind regards

Bernd



Am 03.11.2014 16:09, schrieb J.M.:
> OK, unless I'm really missing something, this is a "no way" proposition.
> What I could really use is a _simple_ way to create non-EBCDIC literal
> strings. So that I could easily do somethng like:
>
> const char[]=ISO8859-1("This is an ISO8850-1 encoded string");
>
> Yes, I could just render that in "escape sequences". But that is _ugly_ and
> not as easily (intuitively) understood. Or I could use iconv() to convert
> it at run time.
>
> And ideas no how to accomplish my goal - easily?
>

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to listserv@listserv.ua.edu with the message: INFO IBM-MAIN

Blog-Hauptseite      Neuester Artikel      Älterer Artikel      Neuerer Artikel      Älterer gleiche Kategorie      Neuerer gleiche Kategorie