Sponsored Content
Full Discussion: Similar functions in unix
Top Forums Programming Similar functions in unix Post 302287568 by odys on Saturday 14th of February 2009 09:44:39 AM
Old 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

Would need a friend on the net, someone who knows a lot of UNIX or similar...

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

I need a Unix OS similar to HP-UX

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

Standard UNIX functions

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

unix functions

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

Recursive functions in Unix

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

Counting similar lines from file UNIX

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

How to execute functions or initiate functions as command line parameters for below requirement?

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?

Similar Threads Redesign for UNIX.com

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

How to compare two files in UNIX using similar to vlookup?

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
MBTOWC(3)						   BSD Library Functions Manual 						 MBTOWC(3)

NAME
mbtowc -- converts a multibyte character to a wide character LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <stdlib.h> int mbtowc(wchar_t * restrict pwc, const char * restrict s, size_t n); DESCRIPTION
mbtowc() usually converts the multibyte character pointed to by s to a wide character, and stores it in the wchar_t object pointed to by pwc if pwc is non-NULL and s points to a valid character. This function may inspect at most n bytes of the array beginning from s. In state-dependent encodings, s may point to the special sequence bytes to change the shift-state. Although such sequence bytes correspond to no individual wide-character code, mbtowc() changes its own state by the sequence bytes and treats them as if they are a part of the sub- sequence multibyte character. Unlike mbrtowc(3), the first n bytes pointed to by s need to form an entire multibyte character. Otherwise, this function causes an error. Calling any other functions in Standard C Library (libc, -lc) never changes the internal state of mbtowc(), except for calling setlocale(3) with changing the LC_CTYPE category of the current locale. Such setlocale(3) call causes the internal state of this function to be indeter- minate. The behaviour of mbtowc() is affected by the LC_CTYPE category of the current locale. There are special cases: s == NULL mbtowc() initializes its own internal state to an initial state, and determines whether the current encoding is state-depen- dent. This function returns 0 if the encoding is state-independent, otherwise non-zero. In this case, pwc is completely ignored. pwc == NULL mbtowc() executes the conversion as if pwc is non-NULL, but a result of the conversion is discarded. n == 0 In this case, the first n bytes of the array pointed to by s never form a complete character. Thus, the mbtowc() always fails. RETURN VALUES
Normally, the mbtowc() returns: 0 s points to a nul byte (''). positive Number of bytes for the valid multibyte character pointed to by s. There are no cases that the value returned is greater than the value of the MB_CUR_MAX macro. -1 s points to an invalid or an incomplete multibyte character. The mbtowc() also sets errno to indicate the error. When s is equal to NULL, mbtowc() returns: 0 The current encoding is state-independent. non-zero The current encoding is state-dependent. ERRORS
mbtowc() may cause an error in the following case: [EILSEQ] s points to an invalid or incomplete multibyte character. SEE ALSO
mblen(3), mbrtowc(3), setlocale(3) STANDARDS
The mbtowc() function conforms to ANSI X3.159-1989 (``ANSI C89''). The restrict qualifier is added at ISO/IEC 9899:1999 (``ISO C99''). BSD
February 3, 2002 BSD
All times are GMT -4. The time now is 03:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy