By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,778 Members | 1,947 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,778 IT Pros & Developers. It's quick & easy.

getw

P: n/a

hello,there.
I just find there's a function in FreeBSD 4.8 above called 'getw()'.
This is from manpage 'man 3 getw'.
GETC(3) FreeBSD Library Functions Manual GETC(3)

NAME
fgetc, getc, getchar, getw -- get next character or word from
input stream

---skipped and then is description---
The getw() function obtains the next int (if present) from the stream
pointed at by stream.

Is this function a GNU C extension or just a FreeBSD special function?
Thanks.
Nov 14 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
wc******@csie.nctu.edu.tw writes:
I just find there's a function in FreeBSD 4.8 above called 'getw()'.
This is not a standard C library function.
Is this function a GNU C extension or just a FreeBSD special function?


It's not a GNU extension, although it is provided by the GNU C
library. Rather, it is from SVID, according to the GNU C library
manual:

- Function: int getw (FILE *STREAM)
This function reads a word (that is, an `int') from STREAM. It's
provided for compatibility with SVID. We recommend you use
`fread' instead (*note Block Input/Output::). [...]
--
char a[]="\n .CJacehknorstu";int putchar(int);int main(void){unsigned long b[]
={0x67dffdff,0x9aa9aa6a,0xa77ffda9,0x7da6aa6a,0xa6 7f6aaa,0xaa9aa9f6,0x1f6},*p=
b,x,i=24;for(;p+=!*p;*p/=4)switch(x=*p&3)case 0:{return 0;for(p--;i--;i--)case
2:{i++;if(1)break;else default:continue;if(0)case 1:putchar(a[i&15]);break;}}}
Nov 14 '05 #2

P: n/a
Ben Pfaff wrote:
wc******@csie.nctu.edu.tw writes:

I just find there's a function in FreeBSD 4.8 above called 'getw()'.

This is not a standard C library function.

Is this function a GNU C extension or just a FreeBSD special function?

It's not a GNU extension, although it is provided by the GNU C
library. Rather, it is from SVID, according to the GNU C library
manual:

- Function: int getw (FILE *STREAM)
This function reads a word (that is, an `int') from STREAM. It's
provided for compatibility with SVID. We recommend you use
`fread' instead (*note Block Input/Output::). [...]


There are a few similarly named functions: getwc, fgetwc, fgetws,
getwchar, and ungetwc. These seem to be for a completely different
purpose, however. All of them were added with Normative Addendum 1
(C94/95) and are declared in <wchar.h>.

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.
Nov 14 '05 #3

P: n/a
Kevin Goodsell wrote:
There are a few similarly named functions: getwc, fgetwc, fgetws,
getwchar, and ungetwc. These seem to be for a completely different
purpose, however. All of them were added with Normative Addendum 1
(C94/95) and are declared in <wchar.h>.


Yes, these functions are the wide-character versions of getc(),fgetc(),fgets()
etc.

However as far as I know getw() should mean something like "get word".

-Robert

--
Robert Bachmann _ _
Ro*************@rbdev.net |_) |_)
| \.|_).

Nov 14 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.