02-21-2008
I changed you code little bit to try and I get the following output
Quote:
test=a
valeur=`printf %u "$test"`
char=`expr $valeur + 1`
#printf %c $char "\n"
printf "$char \n"
printf "\\$char \n"
printf "\<ascii number>" gives the ascii character for that value.
The "valeur" is taking the value of 97.
I assumed the value of "A" is 65.
When I run the following command in ksh I get the value of A as 101
Quote:
cat /usr/share/lib/pub/ascii
I have no idea why I'm getting the weird output
Last edited by bobbygsk; 02-21-2008 at 07:09 PM..
10 More Discussions You Might Find Interesting
1. UNIX Desktop Questions & Answers
I've been having trouble trying to read an ASCII file. I'm on an IRIX machine, by the way. I've tried "cat" and I get a bunch of unreadable text, and the "string" command gets the "Command not Found" error. Please advise.
Thanks. (1 Reply)
Discussion started by: sherbet808
1 Replies
2. UNIX for Dummies Questions & Answers
a silly question but is there a way to display individual ascii values
say if i type 65 it will display the letter instead?
thanks fo any help. (3 Replies)
Discussion started by: melkor
3 Replies
3. Programming
Hi all,
I would like to change the extended ascii code ( 128 - 255).
I tried to change LC_ALL and LANG in current session ( values from locale -a) and for no good.
Thanks. (0 Replies)
Discussion started by: avis
0 Replies
4. Shell Programming and Scripting
I'm a question:
the expresiion 'expr $a +1' use the caracter --> ' (is not shift+ ? !!!)
what is the code ascii for generate this caracter ??????
tank's (3 Replies)
Discussion started by: ZINGARO
3 Replies
5. Shell Programming and Scripting
Hi,
Is there a way to convert the binary file to ascii . the binary file is pipe delimited.
from source the file(pipe delimited) is ftped to mainframe and from mainframe it is ftped to the unix box using binary format. Is there a way to change it back to ascii and view it?
Thanks! (3 Replies)
Discussion started by: dnat
3 Replies
6. Shell Programming and Scripting
Hi gurus,
I have a file in unix with ascii values. I need to convert all the ascii values in the file to ascii characters. File contains nearly 20000 records with ascii values. (10 Replies)
Discussion started by: sandeeppvk
10 Replies
7. Shell Programming and Scripting
Hello dears,
I have a CVS file in wich a have many lines. each line is ended by this two caracters ';;'. I want to get a new format of this file by deleting this caracters which unix shell script
eg. of input file:
a;b;c;d;;
a;b;c;;
a;b;;
a;b;c;d;e;;
That means each line lenght can... (2 Replies)
Discussion started by: yeclota
2 Replies
8. Programming
Let's suppose i have a hexadecimal array with 16 cells.for example
b3e2d5f636111780
i want to convert it to an array of ascii characters(in C) so that
i can reduce total size of the file i want to put it in.
But i am afraid i have not fully understand the difference between ascii
and hex(i... (3 Replies)
Discussion started by: bashuser2
3 Replies
9. Shell Programming and Scripting
hi guys
In my bash script I need to use ascii characters such as SYN(22) and US(31).
How do I echo them? (3 Replies)
Discussion started by: vlm
3 Replies
10. Shell Programming and Scripting
Hi All,
I have an ascii file in which few columns are having hex values which i need to convert into ascii. Kindly suggest me what command can be used in unix shell scripting?
Thanks in Advance (2 Replies)
Discussion started by: HemaV
2 Replies
LEARN ABOUT DEBIAN
explain_printf_or_die
explain_printf_or_die(3) Library Functions Manual explain_printf_or_die(3)
NAME
explain_printf_or_die - formatted output conversion and report errors
SYNOPSIS
#include <libexplain/printf.h>
int explain_printf_or_die(const char *format);
int explain_printf_on_error(const char *format);
DESCRIPTION
The explain_printf_or_die function is used to call the printf(3) system call. On failure an explanation will be printed to stderr, obtained
from the explain_printf(3) function, and then the process terminates by calling exit(EXIT_FAILURE).
The explain_printf_on_error function is used to call the printf(3) system call. On failure an explanation will be printed to stderr,
obtained from the explain_printf(3) function, but still returns to the caller.
format The format, exactly as to be passed to the printf(3) system call.
RETURN VALUE
The explain_printf_or_die function only returns on success, see printf(3) for more information. On failure, prints an explanation and
exits, it does not return.
The explain_printf_on_error function always returns the value return by the wrapped printf(3) system call.
EXAMPLE
The explain_printf_or_die function is intended to be used in a fashion similar to the following example:
int result = explain_printf_or_die(format);
SEE ALSO
printf(3)
formatted output conversion
explain_printf(3)
explain printf(3) errors
exit(2) terminate the calling process
COPYRIGHT
libexplain version 0.52
Copyright (C) 2010 Peter Miller
explain_printf_or_die(3)