02-14-2009
Try functions like 'mbtowc' that are C99 conformant or 'iconv' (POSIX).
Former need correct setting of LC_CTYPE, latter also needs to specify conversion details.
In my case, when I obtained working code with them, I decided to write
my own code for wchar_t / UTF-8 conversion.
9 More Discussions You Might Find Interesting
1. Cybersecurity
Hi! I'm fully aware of that this is not a chat forum,
at least it's not what it's intended to be, but i do not
find any better way of dealing with my problem...
I'm using, well at least right now, a text based webbrowser,
the LYNX actually, for the first time, works pretty well...
Would like... (0 Replies)
Discussion started by: zeus
0 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I am trying to quickly learn Unix because I am going to be using HP-UX soon.
Problem is I can't find download HP-UX.
Does anyone know a Unix OS I can download that is more like HP-UX?
I'm running windows vista at the moment. (3 Replies)
Discussion started by: budz
3 Replies
3. Programming
Hi everybody,
first of all i apologize if my thread's title doesn't make much sense,but i coudn't find a more appropriate name :)
Then i apologize about my question,which probably will sound trivial for you :) :)
I am working on a program which is being tested in Linux but the final target is... (2 Replies)
Discussion started by: Zipi
2 Replies
4. UNIX for Dummies Questions & Answers
Hi All,
i have two functions in my script.
question()
{
num=`ps -e | grep ps | awk -F" " '{print $1}'`
qno=`expr $num % 10`
grade=grade1
cat grade1/$qno
answer ${grade} ${qno}
}
answer()
{
grade=$1
qno=$2
ansno=`wc -l $grade/ans/$qno | cut -d' ' -f1`
j=0
while
do (1 Reply)
Discussion started by: Usha Shastri
1 Replies
5. Shell Programming and Scripting
Hi Guys,
Is there a way to write a recursive function in unix?
Thanks for your help in advance,
Regards,
Magesh. (1 Reply)
Discussion started by: mac4rfree
1 Replies
6. Shell Programming and Scripting
I have a file which contains data as below:
nbk1j7o pageName=/jsp/RMBS/RMBSHome.jsf
nbk1j7o pageName=/jsp/RMBS/RMBSHome.jsf
nbk1j7o pageName=/jsp/RMBS/RMBSHome.jsf
nbk1j7o pageName=/jsp/RMBS/RMBSHome.jsf
nbk1j7o pageName=/jsp/common/index.jsf
nbk1j7o pageName=/jsp/common/index.jsf
nbk1wqe... (6 Replies)
Discussion started by: mohsin.quazi
6 Replies
7. Shell Programming and Scripting
I have 7 functions those need to be executed as command line inputs, I tried with below code it’s not executing function. If I run the ./script 2 then fun2 should execute , how to initiate that function I tried case and if else also, how to initiate function from command line
if
then... (8 Replies)
Discussion started by: saku
8 Replies
8. What is on Your Mind?
Hello.
I have redesigned our "similar threads" for a more "clean style" in both the desktop view and the mobile view for the forum "show thread".
The new design is a simple straight-forward use of div elements and all the legacy table elements have been removed.
The result is a "clean"... (7 Replies)
Discussion started by: Neo
7 Replies
9. UNIX for Beginners Questions & Answers
Hi,
I want to compare same column in two files, if values match then display the column or display "NA".
Ex :
File 1 :
123
abc
xyz
pqr
File 2:
122
aab
fdf
pqr
fff
qqq
rrr (1 Reply)
Discussion started by: hkoshekay
1 Replies
LEARN ABOUT ULTRIX
mbtowc
mbtowc(3int) mbtowc(3int)
Name
mbtowc - converts a single multibyte character into a character of type wchar_t
Syntax
#include <stdlib.h>
int mbtowc (pwc, s, n)
wchar_t *pwc;
const char *s;
size_t n;
Arguments
pwc The pwc argument is a pointer to the resulting object of type wchar_t.
s The s argument is a pointer to a multibyte character.
n The n argument is the maximum number of bytes of object s that are examined.
Description
If s is not a null pointer, the function determines the number of bytes that comprise the multibyte character pointed to by s. It then
determines the character code for the value (of type wchar_t) that corresponds to that multibyte character (the value of the code corre-
sponding to the null character is zero). If the multibyte character is valid and pwc is not a null pointer, the function stores the code in
the object pointed to by pwc. At most n bytes of the array pointed to by s are examined. This function is affected by the LC_CTYPE cate-
gory of the current locale.
Return Values
If s is a null pointer, the function returns a zero value. If s is not a null pointer, the function returns:
o 0, if s points to the null character
o The number of bytes that comprise the converted multibye character, if the next n or fewer bytes form a valid multibye character
o - -1, if the next n or fewer bytes do not form a valid multibye character
In no case is the value returned greater than n or the value of the MB_CUR_MAX macro.
See Also
mblen(3int), mbstowcs(3int), setlocale(3int), wctomb(3int), wcstombs(3int)
mbtowc(3int)