📄 ge
字号:
@c ----------------------------------------------------------------------
@node _get_default_drive, dos
@heading @code{_get_default_drive}
@subheading Syntax
@example
int _get_default_drive(void);
@end example
@subheading Description
Gets the default drive.
@subheading Return Value
0 for drive A:, 1 for drive B:, etc, up to 26 for Z:
@subheading Example
@example
printf("Current drive is %c:\n", _get_current_drive()+'a');
@end example
@c ----------------------------------------------------------------------
@node getc, stdio
@heading @code{getc}
@subheading Syntax
@example
#include <stdio.h>
int getc(FILE *file);
@end example
@subheading Description
Get one character from @var{file}.
@subheading Return Value
The character ([0..255]) or @code{EOF} if eof or error.
@subheading Example
@example
int c;
while ((c=getc(stdin)) != EOF)
putc(c, stdout);
@end example
@c ----------------------------------------------------------------------
@node getcbrk, dos
@heading @code{getcbrk}
@subheading Syntax
@example
#include <dos.h>
int getcbrk(void);
@end example
@subheading Description
Get the setting of the Ctrl-C checking flag in MS-DOS.
@xref{setcbrk}
@subheading Return Value
0 if not checking, 1 if checking.
@c ----------------------------------------------------------------------
@node getchar, stdio
@heading @code{getchar}
@subheading Syntax
@example
#include <stdio.h>
int getchar(void);
@end example
@subheading Description
The same as @code{fgetc(stdin)} (@pxref{fgetc}).
@subheading Return Value
The character, or @code{EOF}.
@c ----------------------------------------------------------------------
@node getcwd, file system
@heading @code{getcwd}
@subheading Syntax
@example
#include <osfcn.h>
char *getcwd(char *buffer, int max);
@end example
@subheading Description
Get the current directory. The return value includes the drive
specifier. If @var{buffer} is @code{NULL}, a buffer of size @var{max}
is allocated. This call fails if more than @var{max} characters are
required to specify the current directory.
If @code{getcwd} allocates a buffer for you, you may later free is with
@code{free}.
@subheading Return Value
The buffer, either @var{buffer} or a newly-allocated buffer, or
@code{NULL} on error.
@subheading Example
@example
char *buf = getcwd(0, PATH_MAX);
printf("cwd is %s\n", buf);
free(buf);
@end example
@c ----------------------------------------------------------------------
@node getdate, time
@heading @code{getdate}
@subheading Syntax
@example
#include <dos.h>
void getdate(struct date *);
@end example
@subheading Description
This function gets the current date. The return structure is as follows:
@example
struct date @{
short da_year;
char da_day;
char da_mon;
@};
@end example
@xref{setdate} @xref{gettime}
@subheading Return Value
None.
@subheading Example
@example
struct date d;
getdate(&d);
@end example
@c ----------------------------------------------------------------------
@node getdfree, file system
@heading @code{getdfree}
@subheading Syntax
@example
#include <dos.h>
void getdfree(unsigned char drive, struct dfree *ptr);
@end example
@subheading Description
This function gets information about the size and fullness of the given
drive (0=default, 1=A:, etc). The return structure is as follows:
@example
struct dfree @{
unsigned df_avail; /* number of available clusters */
unsigned df_total; /* total number of clusters */
unsigned df_bsec; /* bytes per sector */
unsigned df_sclus; /* sectors per cluster */
@};
@end example
@subheading Return Value
None.
@subheading Example
@example
struct dfree d;
getdfree(3, &d); /* drive C: */
@end example
@c ----------------------------------------------------------------------
@node getdisk, dos
@heading @code{getdisk}
@subheading Syntax
@example
#include <dir.h
int getdisk(void);
@end example
@subheading Description
Gets the current disk (0=A).
@xref{setdisk}
@subheading Return Value
The current disk.
@subheading Example
@example
printf("This drive is %c:\n", getdisk() + 'A');
@end example
@c ----------------------------------------------------------------------
@node getdtablesize, posix
@heading @code{getdtablesize}
@subheading Syntax
@example
#include <osfcn.h>
int getdtablesize(void);
@end example
@subheading Description
Get the maximum number of open file descriptors the system supports.
Should depend on the setting of @code{FILES=} in @file{config.sys}, but
is currently hardcoded to 50.
@subheading Return Value
The number of file descriptors.
@c ----------------------------------------------------------------------
@node getegid, unix
@heading @code{getegid}
@subheading Syntax
@example
#include <osfcn.h>
int getegid(void);
@end example
@subheading Description
Get the effective group id.
@subheading Return Value
42
@c ----------------------------------------------------------------------
@node getenv, environment
@heading @code{getenv}
@subheading Syntax
@example
#include <stdlib.h>
char *getenv(const char *name);
@end example
@subheading Description
Get the setting of the environment variable @var{name}. Do not alter or
free the returned value.
@subheading Return Value
The value, or @code{NULL} if that variable does not exist.
@subheading Example
@example
char *term = getenv("TERM");
@end example
@c ----------------------------------------------------------------------
@node geteuid, unix
@heading @code{geteuid}
@subheading Syntax
@example
#include <osfcn.h>
int geteuid(void);
@end example
@subheading Description
Gets the effective UID.
@subheading Return Value
42
@c ----------------------------------------------------------------------
@node getftime, file system
@heading @code{getftime}
@subheading Syntax
@example
#include <dos.h>
int getftime(int handle, struct ftime *ptr);
@end example
@subheading Description
Get the timestamp for the given file handle. The return structure is as
follows:
@example
struct ftime @{
unsigned ft_tsec:5; /* 0-29, double to get real seconds */
unsigned ft_min:6; /* 0-59 */
unsigned ft_hour:5; /* 0-23 */
unsigned ft_day:5; /* 1-31 */
unsigned ft_month:4; /* 1-12 */
unsigned ft_year:7; /* since 1980 */
@}
@end example
@subheading Return Value
Zero on success, nonzero on failure.
@subheading Example
@example
struct ftime t;
getftime(fd, &t);
@end example
@c ----------------------------------------------------------------------
@node getgid, unix
@heading @code{getgid}
@subheading Syntax
@example
#include <osfcn.h>
int getgid(void);
@end example
@subheading Description
Get the current group id.
@subheading Return Value
42
@c ----------------------------------------------------------------------
@node getgrent, unix
@heading @code{getgrent}
@subheading Syntax
@example
#include <grp.h>
struct group *getgrent(void);
@end example
@subheading Description
This function returns the next available group entry. Note that for
MS-DOS, this is simulated. If the environment variable GROUP is set,
that is the name of the only group returned, else the only group is
"other".
The return type of this and related function is as follows:
@example
struct group @{
char * gr_name; /* "other" or getenv("GROUP"); */
char * gr_passwd; /* "*" */
int gr_gid; /* result of getgid() */
char ** gr_mem; /* always empty */
@};
@end example
@subheading Return Value
The next structure, or @code{NULL} at the end of the list.
@subheading Example
@example
struct group *g;
setgrent();
while ((g = getgrent()) != NULL)
@{
printf("group %s gid %d\n", g->gr_name, g->gr_gid);
@}
endgrent();
@end example
@c ----------------------------------------------------------------------
@node getgrgid, unix
@heading @code{getgrgid}
@subheading Syntax
@example
#include <grp.h>
extern struct group *getgrgid(int gid);
@end example
@subheading Description
This function returns the group entry that matches @var{gid}.
@xref{getgrent}
@subheading Return Value
The matching group, or @code{NULL} if none match.
@c ----------------------------------------------------------------------
@node getgrnam, unix
@heading @code{getgrnam}
@subheading Syntax
@example
#include <grp.h>
struct group *getgrnam(char *name);
@end example
@subheading Description
This function returns the group entry for the group named @var{name}.
@xref{getgrent}
@subheading Return Value
The matching group, or @code{NULL} if none match.
@c ----------------------------------------------------------------------
@node getgroups, unix
@heading @code{getgroups}
@subheading Description
This function is provided only to assist in porting from Unix. It
always returns an error condition.
@c ----------------------------------------------------------------------
@node getkey, dos
@heading @code{getkey}
@subheading Syntax
@example
#include <pc.h>
#include <keys.h>
int getkey(void);
@end example
@subheading Description
Waits for the user to press one key, then returns that key. Alt-key
combinations have 0x100 added to them. Extended keys return their
non-extended codes.
The file @file{keys.h} has symbolic names for many of the keys.
@xref{getxkey}
@subheading Return Value
The key pressed.
@subheading Example
@example
while (getkey() != K_Alt_3)
do_something();
@end example
@c ----------------------------------------------------------------------
@node getlogin, unix
@heading @code{getlogin}
@subheading Syntax
@example
#include <unistd.h>
char *getlogin(void);
@end example
@subheading Description
Get the login ID of the user.
@subheading Return Value
Returns the value of the @code{USER} environment variable, else the
@code{LOGNAME} environment variable, else @code{"dosuser"}.
@subheading Example
@example
printf("I am %s\n", getlogin());
@end example
@c ----------------------------------------------------------------------
@node getlongpass, unix
@heading @code{getlongpass}
@subheading Syntax
@example
int getlongpass(const char *prompt, char *password, int max_length);
@end example
@subheading Description
Read a password from the user. First, the prompt is sent to
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -