⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ge

📁 Algorithms for Image Processing and Computer Vision Source Code
💻
📖 第 1 页 / 共 2 页
字号:
@code{stderr}.  The characters typed are not echoed, and backspace can
be used to edit the line.  The password will be stored in
@var{password}, up to @var{max_length} characters.  When the user
hits @key{Return} or @key{Enter}, a newline is printed to @code{stderr} and the
password is returned.

@subheading Return Value

Zero on success, nonzero on failure.

@subheading Example

@example
@end example

@c ----------------------------------------------------------------------
@node getmntent, unix
@heading @code{getmntent}
@subheading Syntax

@example
#include <mntent.h>

struct mntent *getmntent(FILE *filep);
@end example

@subheading Description

This function returns information about the various drives that are
available to your program.  Beginning with drive @code{A:}, information
is retrieved for successive drives with successive calls to
@code{getmntent}.  Note that drives @code{A:} and @code{B:} will only be
returned if they are the current drive, otherwise the first drive
returned is @code{C:}.

This function operates by reading the volume label, so unlabelled disks
will not be available.  For each drive scanned, a pointer to a static
structure of the following type is returned:

@example
struct mntent
@{
    char * mnt_fsname;  /* The volume name */
    char * mnt_dir;     /* The drive name (like "c:") */
    char * mnt_type;    /* "dos" */
    char * mnt_opts;    /* "rw" */
    int    mnt_freq;    /* -1 */
    int    mnt_passno;  /* -1 */
    long   mnt_time;    /* -1 */
@};
@end example

@subheading Return Value

This function returns a pointer to an @code{struct} @code{mntent}, or
NULL if there are no more drives to report on. 

@subheading Example

@example
struct mntent *m;
FILE *f;
f = setmntent("", "");
while (m = getmntent(f))
  printf("Drive %s, name %s\n", m->mnt_dir, m->mnt_fsname);
endmntent(f);
@end example

@c ----------------------------------------------------------------------
@node getopt, misc
@heading @code{getopt}
@subheading Syntax

@example
int getopt(int argc, char * const *argv, const char *options);
extern char *optarg;
extern int optind, opterr;
extern char optopt;
@end example

@subheading Description

Parse options from the command line.  The @var{options} are a string of
valid option characters.  If a given option takes a parameter, that
character should be followed by a colon.

For each valid switch, this function sets @code{optarg} to the argument
(if the switch takes one), sets @code{optind} to the index in @var{argv}
that it is using, sets @code{optopt} to the option letter found, and
returns the option letter found.

If an unexpected option is found, @code{getopt} will return @code{?},
and if @code{opterr} is nonzero, will print an error message to stderr. 

The special option @code{--} indicates that no more options follow on
the command line, and cause @code{getopt} to stop looking. 

@subheading Return Value

The option found, or -1 if no more options.

@subheading Example

@example
int c;
opterr = 0;
while ((c=getopt(argc, argv, "vbf:")) != -1)
@{
  switch (c)
  @{
    case 'v':
      verbose_flag ++;
      break;
    case 'b':
      binary_flag ++;
      break;
    case 'f':
      output_filename = optarg;
      break;
    case '?':
      printf("Unknown option %c\n", c);
      usage();
      exit(1);
  @}
@}
@end example

@c ----------------------------------------------------------------------
@node getpagesize, misc
@heading @code{getpagesize}
@subheading Syntax

@example
#include <osfcn.h>

int getpagesize(void);
@end example

@subheading Description

Return the size of the native virtual memory page size.

@subheading Return Value

4096 for the i386 and higher processors.

@c ----------------------------------------------------------------------
@node getpass, unix
@heading @code{getpass}
@subheading Syntax

@example
#include <unistd.h>

char *getpass(const char *prompt);
@end example

@subheading Description

Prompts the user with @var{prompt} and accepts a non-echoed password. 
@xref{getlongpass}

@subheading Return Value

A pointer to a static buffer is returned.  This buffer is overridden
with each call to @code{getpass}.

@subheading Example

@example
char *pw = getpass("Enter password : ");
@end example

@c ----------------------------------------------------------------------
@node getpid, unix
@heading @code{getpid}
@subheading Syntax

@example
#include <osfcn.h>

int getpid(void);
@end example

@subheading Description

Get the process ID, which uniquely identifies each program running on
the system. 

@subheading Return Value

The process ID.

@c ----------------------------------------------------------------------
@node getpwent, unix
@heading @code{getpwent}
@subheading Syntax

@example
#include <pwd.h>

struct passwd *getpwent(void);
@end example

@subheading Description

This function retrieves the next available password file entry. 
For MS-DOS, this is simulated by providing exactly one entry:

@example
struct passwd @{
  char * pw_name;    /* getlogin() */
  char * pw_passwd;  /* "*" */
  int    pw_uid;     /* getuid() */
  int    pw_gid;     /* getgid() */
  char * pw_age;     /* "" */
  char * pw_comment; /* "" */
  char * pw_gecos;   /* "DOS User" */
  char * pw_dir;     /* "/" or getenv("HOME") */
  char * pw_shell;   /* "/bin/sh" or getenv("SHELL") */
  long   pw_audid;   /* -1 */
  int    pw_audflg;  /* -1 */
@};
@end example

@subheading Return Value

The next passwd entry, or @code{NULL} if there are no more.

@subheading Example

@example
struct passwd *p;
setpwent();
while ((p = getpwent()) != NULL)
@{
  printf("user %s name %s\n", p->pw_name, p->pw_gecos);
@}
endpwent();
@end example

@c ----------------------------------------------------------------------
@node getpwnam, unix
@heading @code{getpwnam}
@subheading Syntax

@example
#include <pwd.h>

struct passwd *getpwnam(char *name);
@end example

@subheading Description

This function gets the password file entry matchine @var{name}.  @xref{getpwent}

@subheading Return Value

The matching record, or @code{NULL} if none match.

@c ----------------------------------------------------------------------
@node getpwuid, unix
@heading @code{getpwuid}
#include <pwd.h>

struct passwd *getpwuid(int uid);
@subheading Syntax

@example
@end example

@subheading Description

This function gets the password file entry matchine @var{uid}.  @xref{getpwent}

@subheading Return Value

The matching record, or @code{NULL} if none match.

@c ----------------------------------------------------------------------
@node getrusage, unix
@heading @code{getrusage}
@subheading Syntax

@example
#include <sys/time.h>
#include <sys/resource.h

int getrusage(int who, struct rusage *rusage);
@end example

@subheading Description

This function returns information about the running process.  Currently,
the only field that is computed is this:

@example
struct rusage @{
  struct timeval ru_utime;  /* total time used by process */
@};
@end example

The remainder of the fields are set to zero.

The @var{who} parameter must be @code{RUSAGE_SELF} or
@code{RUSAGE_CHILDREN}. 

@subheading Return Value

Zero on success, nonzero on failure.

@subheading Example

@example
struct rusage r;
getrusage(RUSAGE_SELF, &r);
@end example

@c ----------------------------------------------------------------------
@node gets, stdio
@heading @code{gets}
@subheading Syntax

@example
#include <stdio.h>

char *gets(char *buffer);
@end example

@subheading Description

Reads characters from @code{stdin}, storing them in @var{buffer}, until
either end of file or a newline is encountered.  If any characters were
stored, the @var{buffer} is then @code{NULL} terminated and it's address
is returned, else @code{NULL} is returned.

@subheading Return Value

The address of the buffer, or @code{NULL}.

@subheading Example

@example
char buf[1000];
while (gets(buf))
  puts(buf);
@end example

@c ----------------------------------------------------------------------
@node gettime, time
@heading @code{gettime}
@subheading Syntax

@example
#include <dos.h>

void gettime(struct time *);
@end example

@subheading Description

This function gets the current time.  The return structure is as follows:

@example
struct time @{
  unsigned char ti_min;
  unsigned char ti_hour;
  unsigned char ti_hund;
  unsigned char ti_sec;
@};
@end example

@xref{settime} @xref{getdate}

@subheading Return Value

None.

@subheading Example

@example
struct time t;
gettime(&t);
@end example

@c ----------------------------------------------------------------------
@node gettimeofday, time
@heading @code{gettimeofday}
@subheading Syntax

@example
#include <sys/time.h>

int gettimeofday(struct timeval *tp, struct timezone *tzp);
@end example

@subheading Description

Gets the current GMT time and the local timezone information.  The
return structures are as follows:

@example
struct timeval @{
  long tv_sec;  /* seconds since 00:00:00 GMT 1/1/1970 */
  long tv_usec; /* microseconds */
@};
struct timezone @{
  int tz_minuteswest; /* west of GMT */
  int tz_dsttime;     /* set if daylight saving time in affect */
@};
@end example

If either @var{tp} or @var{tzp} are @code{NULL}, that information is not
provided. 

@xref{settimeofday}

@subheading Return Value

Zero on success, nonzero on failure.

@c ----------------------------------------------------------------------
@node getuid, unix
@heading @code{getuid}
@subheading Syntax

@example
#include <osfcn.h>

int getuid(void);
@end example

@subheading Description

Returns the user ID.

@subheading Return Value

42

@c ----------------------------------------------------------------------
@node getw, stdio
@heading @code{getw}
@subheading Syntax

@example
#include <stdio.h>

int getw(FILE *file);
@end example

@subheading Description

Reads a single binary word in native format from @var{file}.

@xref{putw}

@subheading Return Value

The value read, or @code{EOF} for end-of-file or error.  Since
@code{EOF} is a valid integer, you should use @code{feof} or
@code{ferror} to detect this situation. 

@subheading Example

@example
int i = getw(stdin);
@end example

@c ----------------------------------------------------------------------
@node getwd, file system
@heading @code{getwd}
@subheading Syntax

@example
#include <osfcn.h>

char *getwd(char *buffer);
@end example

@subheading Description

Get the current directory and put it in @var{buffer}.  The return value
includes the drive specifier. 

@subheading Return Value

@var{buffer} is returned.

@subheading Example

@example
char buf[PATH_MAX];
getwd(buf);
@end example

@c ----------------------------------------------------------------------
@node getxkey, dos
@heading @code{getxkey}
@subheading Syntax

@example
#include <pc.h>
#include <keys.h>

int getxkey(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, and extended keys have 0x200
added to them. 

The file @file{keys.h} has symbolic names for many of the keys.

@xref{getkey}

@subheading Return Value

The key pressed.

@subheading Example

@example
while (getxkey() != K_EEnd)
  do_something();
@end example

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -