473,378 Members | 1,351 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

getw


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
3 4963
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Gregory Hassett | last post by:
Hi, I have a web service called GetComputerNameAndDescription which I can call from the main thread of my app. If I call it from a separate thread, however, it hangs on the call to Invoke() -- but...
7
by: Marcelo | last post by:
Hi everybody, I don't understand why I am having a problem in this code. The problem is that my pointer *phist in main method, it is declared. Then I send the pointer to my method, and this...
4
by: joby mathai | last post by:
i was able to open the .wav file using c program, but while reading,its not reading the full file.i opened the .wav file in visual cpp and compared it with the program output.so many data...
12
by: Registered User | last post by:
I've read in a book: <quote> With a binary-mode stream, you can't detect the end-of-file by looking for EOF, because a byte of data from a binary stream could have that value, which would...
6
by: traceygj | last post by:
Hi im kind of new too this, but im using the quadtree data structure for a project that i am working on. I am using this to recursively partition an image depending on the levels of pixel variance in...
5
by: Christian Johannes Charbula | last post by:
hi, does anybody know how i can get the information what width for a ostream is actually set? i want to do somthing like the following, and need a way to do something like stream.getw(). ...
2
BSCode266
by: BSCode266 | last post by:
Hi, This is some code in the first class: //the array of pointers Slot *slots; //the get method for the previous array //The first error occurs here: error C2440: 'return' : cannot...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.