Macros have been used to simulate inline functions from the very beginning of C. From the getc man page:
Code:
The getc(3) function acts essentially identically to fgetc(3), but is a
macro that expands in-line.
The getchar(3) function is equivalent to:
getc(stdin)
And many other "functions" included in the std i/o library are really macros. Take a peek at stdio.h.
I'm having a problem with a macro i put in my .exrc file.
Here's what I put: map #I ^[
^ [ is control-v and the escape key.
It places a # a the beginning of a line by simply hitting the # on the keyboard. Problem is, now when I hit "o" or "O" to move up or down a line, it places a # at... (1 Reply)
I'm upleveling code from 10.20 to 11.11....but I'm running into a problem in which the USRSTACK macro does not seem to be defined in 11.11. Has anybody else experienced this/fixed it/worked around it? Is there a different macro I should be using instead?
Thanks for any info you can provide!! (1 Reply)
Hi,
In my application I have some number c files. In each of the file the following line will be the first statement.
#ident "@(#) set.c 14.1.2.2 05/15/01 17:06:32"
I would like to know what is the use of the above statement.
Thanks
Sarwan (1 Reply)
I think there is no problem to use any macro in a new macro definishion, but I have a problem with that.
I can not understand why?
I have a *.mak file that inludes file with many definitions and rules.
##############################################
include dstndflt.mak
...
One of the... (2 Replies)
Hi Experts,
i would like to get your help to do some development to the below linux commands which i run under .cmd file in windows
@echo off
call f:\linuxutils\grep.exe "T11" f:\blocked_ranges\dump3.txt|f:\linuxutils\grep.exe ",9647800"|f:\linuxutils\grep.exe... (3 Replies)
Hi,
I just opened one old RH box and found number of "macros" in there, that how they called in how-to doc, let say you type <rx> and this does a lot of stuff.
I can't figure out how it work, how I can edit/display these macros? Can anybody point to the right directions? I have some academic... (3 Replies)
Hi everyone,
What I am trying to do is assign a F-key a macro to save a file in vi and display said file in firefox. The details are as follows:
I am using a Win 7 laptop with and ssh program to log into a unix system.
What I am trying to do is figure out how to bring up the firefox... (1 Reply)
Hey guys, thanks for lookin....my question is I want to create a macro on HPUX to SFTP a .xls to my Windows Server....I have exstensively searched and all I can find is What a macro is not how to create one.
Reasoning for having a macro is to put it in a file creation script and have it run at... (7 Replies)
Can some body explain this part in a header file for me?
#include <limits.h>
#define BIGNUM unsigned long long
typedef BIGNUM (*hash_t) (char *str);
......I have hard time for the second part:
typedef BIGNUM (*hash_t) (char *str); First, I could not find the definition of hash_t, which... (1 Reply)
Discussion started by: yifangt
1 Replies
LEARN ABOUT NETBSD
getc_unlocked
GETC(3) BSD Library Functions Manual GETC(3)NAME
fgetc, getc, getchar, getc_unlocked, getchar_unlocked, getw -- get next character or word from input stream
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <stdio.h>
int
fgetc(FILE *stream);
int
getc(FILE *stream);
int
getchar();
int
getc_unlocked(FILE *stream);
int
getchar_unlocked();
int
getw(FILE *stream);
DESCRIPTION
The fgetc() function obtains the next input character (if present) from the stream pointed at by stream, or the next character pushed back on
the stream via ungetc(3).
The getc() function acts essentially identically to fgetc(), but is a macro that expands in-line.
The getchar() function is equivalent to: getc with the argument stdin.
The getc_unlocked() and getchar_unlocked() functions provide functionality identical to that of getc() and getchar(), respectively, but do
not perform implicit locking of the streams they operate on. In multi-threaded programs they may be used only within a scope in which the
stream has been successfully locked by the calling thread using either flockfile(3) or ftrylockfile(3), and may later be released using
funlockfile(3).
The getw() function obtains the next int (if present) from the stream pointed at by stream.
RETURN VALUES
If successful, these routines return the next requested object from the stream. If the stream is at end-of-file or a read error occurs, the
routines return EOF. The routines feof(3) and ferror(3) must be used to distinguish between end-of-file and error. If an error occurs, the
global variable errno is set to indicate the error. The end-of-file condition is remembered, even on a terminal, and all subsequent attempts
to read will return EOF until the condition is cleared with clearerr(3).
SEE ALSO ferror(3), flockfile(3), fopen(3), fread(3), ftrylockfile(3), funlockfile(3), putc(3), ungetc(3)STANDARDS
The fgetc(), getc() and getchar() functions conform to ANSI X3.159-1989 (``ANSI C89''). The getc_unlocked() and getchar_unlocked() functions
conform to ISO/IEC 9945-1:1996 (``POSIX.1'').
BUGS
Since EOF is a valid integer value, feof(3) and ferror(3) must be used to check for failure after calling getw(). The size and byte order of
an int varies from one machine to another, and getw() is not recommended for portable applications.
BSD April 25, 2001 BSD