jengelh schrieb:Code:perl -e 'print ++($_="a")'
abgdf schrieb:http://tldp.org/LDP/abs/html/wrapper.html#PRASC
buchstabe=c
zahl=2
printf "\\$(printf %o $(($(echo $buchstabe | od -An -N1 -tu1) + $zahl)))\n"
buchstabe=a
zahl=1
echo -e "\\0$((((26#$buchstabe+87+$zahl)/64)*100+((26#$buchstabe+87+$zahl)/8%8)*10+((26#$buchstabe+87+$zahl)%8)))"
pascii()
{
printf %b "\\0$(printf %o $(($1%256)))"
}
pascii 0107
pascii 71
pascii 0x47
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* printasc.c
Compile with: gcc -Wall -pedantic -o printasc printasc.c */
int checkDigits(char *a);
int main(int argc, char *argv[])
{
int a;
if(argc == 1 || argc > 2)
{
puts("Not enough or too many arguments.");
return 1;
}
if (checkDigits(argv[1]) != 0)
{
puts("Argument must be a number.");
return 2;
}
a = atoi(argv[1]);
if (a < -255 || a > 255)
{
puts("The argument is either too big or too small.");
return 3;
}
printf("%c\n", a);
return 0;
}
int checkDigits(char *a)
{
int i;
for(i = 0; i < strlen(a); i++)
{
if (*(a + i) < '0' || *(a + i) > '9')
{
if (*a != '-')
{
return 1;
}
}
}
return 0;
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
char *err;
unsigned int a;
if(argc != 2) {
puts("Not enough or too many arguments.");
return 1;
}
a = strtoul(argv[1], &err, 0);
if (err != NULL && *err != '\0') {
puts("Argument must be a number.");
return 2;
}
if (a > 255) {
puts("The argument is either too big or too small.");
return 3;
}
printf("%c\n", a);
return 0;
}
"There should be one -- and preferably only one -- obvious way to do it."
http://www.python.org/doc/Humor.html#zen
Deutsche Sonderzeichen sind als "signed char" negativ. Unterhalb von -255 sollten keine mehr sein.Außerdem weiß ich nicht wieso du auf "a < -255" testest...
Kann mir jemand zur Feier des Tages diesen Teilhaveaniceday schrieb:echo -e "\\0`printf %o $((36#$buchstabe+87+$zahl))`"