In the below code I tried to read the entered text in a buffer and showing the length of data read from stdin.
Whether this code will properly read any word having extended ascii characters and be able to show the desired length of the word.?
Thanks,
Moderator's Comments:
Please use CODE tags (not ICODE tags) for multi-line input, output, and code samples.
A few comments that may help you:
The argument you're passing to readFromString() is never referenced.
You can't use scanf() to read a wide character string; use wscanf() instead. (Or preferably, to prevent input buffer overflows, use fgetws().)
You can't print a wide character string using printf(); use wprintf() instead.
What are you trying to determine with the variable size? You're currently calculating the number of wide characters read (not counting the terminating wide null character).
Why bother calling wcstombs()? You exit before you do anything with the the multi-byte string it produces? (Of course, it is likely to core dump since you're telling it to store bytes in the array pointed to by a NULL pointer.)
The 1st argument to wcstombs() needs to be a pointer to an array of type char where the multi-byte string produced by converting the wide character string named by the 2nd argument will be placed. The 3rd argument to wcstombs() needs to be the size of that array(in bytes); not the number of wide characters contained in the wide character string pointed to by the 2nd argument.
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)
hi i would like to check text files if they contain extended ascii characters within or not. i really dont have any idea how to start your kind help would be very much appreciated thanks. (7 Replies)
Can someone help me to write a script / command to read in a file, character by character, replace any unknown ASCII characters with space. then write out the file to a new filename/
Thanks! (1 Reply)
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)
Hi All,
I'm trying to send extended ascii characters to my HP2055 as part of PCL printer control codes. What I want to do is select a bar code font, print the bar code and reset the printer to the default font.
Selecting the bar code font works good. Printing the bar code goes almost ok too. ... (5 Replies)
Hi,
Is there a way to identify the lines in a file having extended ascii characters and display the same?
For instance I have a file abc.txt having below data
aaa|bbb|111|This is first line
aaa|bbb|222|This is secõnd line
aaa|bbb|333|This is third line
aaa|bbb|444|This is foùrth line... (3 Replies)
We are getting extended Ascii characters in the input file and my requirement is to search and replace them with a space. I am using the following command
LANG=C sed -e 's// /g'
It is doing a good job, but in some cases it is replacing the extended characters with two spaces. So my input... (12 Replies)
Hi All,
I am trying to remove (SELECTIVE - passed as argument) Extended ASCII using Awk based on adhoc basis. Can you please let me know how to do it. I have to implement this using awk only.
Thanks & Regads (14 Replies)
I am working with a log file that I am trying to clean up by removing non-English ASCII characters. I am using Bash via Cygwin on Windows.
Before I start I set:
export LC_ALL=C
I clean it up by removing all non-English ASCII characters with the following command;
grep -v $''... (4 Replies)
Hello,
I am on AIX.
When I encounter extended ascii characters and special characters on a file I need to print..
Byte position, actual character and line number.
Is there a simple command that can give me the above result ?
Thanks in advance (38 Replies)