Or perhaps is there a way to add similar fuctionality ?
I'd like to be able to define string of chars when working with C, but there is no simple way of doing this.
In C, "my_string_abc" makes a string (= that text + \n" ) somewhere in predefined read-only data space of a program.
That is, usual way of working with strings is:
char * str1 = "my_string_abc" ( doublequotes)
But this predefines some things I don't want to be done. For one, it reserves string space in constant memory and for another, it automatically appends \n at the end.
C allows me to work with cahr literals, but those are limited to ONE CHAR EACH. So to make string of them, I have to use
single qoutes around { 'e' , 'a' , 'c' , 'h', '_', 'c' , 'h' , 'a' , 'r' }, which is killing me.
Quick workaround is to make a simple CLI util which would accept my string and generate separate header file that I could then include.
But that is major drain on my love of life and PITA in general. :x
Is there a way that I could have some sort of plugin/macro that could automate such things ?
IOW, In C, I can't for example initialize char array with literal succession like:
char myarr[] = { 'my_char_string' }
I have to type each char into its own single qoutes and with comma between chars.
It would be very nice to have a macro which could do that and preferably:
- be able to convert either typed-in string or a content of a file.
-have option for selectable number of columns formatting.
- have option for inserting chars as given in typed string and/or file, their codes in hexa/decimal/octal/binary, their escaped codes like \xxx in hex, octal or bin.
- be able to read binary file, if needed
I suspect this could come very hande for embedded projects ( including various headers, graphic files, icons etc).