Re: [V4R5] enabling isblank() for plain C
Patrik Schindler <[email protected]> Sun, 19 Jan 2025 20:39:10 +0100
| Newsgroups | gmane.comp.lang.as400.c |
|---|---|
| Message-ID | <[email protected]> |
Hello Mark, thanks for your valuable input. Am 19.01.2025 um 15:32 schrieb Mark Waterbury <[email protected]>: > I would stay away from using any C++ functions in ordinary C because C++ has a rather more complex and different runtime environment. Ah, I wasn't aware. > So, when you say "isblank" you mean "whitespace" as far as the compiler is concerned when tokenizing the input -- in other words, the characters to be treated as "white space" (or blanks or spaces), yes? Not sure. See here: https://www.geeksforgeeks.org/isblank-in-cc/ > This is fairly easy to do. > A simple "translate table" type of char array, e.g.: > char whitespace[255]; > > Initialize by: for (i=0; i < 255; i++) whitespace[i] = i; > Then carefully set each position you want translated to a "space" to x'40', for example, assuming #defines are set up for CR, LF, TAB, etc.: Translation is not the goal, but recognizing a character as "blank"; see above. So I'll probably just roll my own. See https://github.com/PoC-dev/asterisk-translate-clid/blob/main/calltransd.c line 273++. :wq! PoC -- This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L) mailing list To post a message email: [email protected] To subscribe, unsubscribe, or change list options, visit: https://lists.midrange.com/mailman/listinfo/c400-l or email: [email protected] Before posting, please take a moment to review the archives at https://archive.midrange.com/c400-l.