cygwin_conv_path(3) Programmer's Manual cygwin_conv_path(3)NAMEcygwin_conv_pathSYNOPSIS
extern "C" ssize_t
cygwin_conv_path (cygwin_conv_path_t what, const void * from, void *
to, size_t size);
DESCRIPTION
Use this function to convert POSIX paths in from to Win32 paths in
toor, vice versa, Win32 paths in from to POSIX paths in to. whatde‐
fines the direction of this conversion and can be any of the below val‐
ues. CCP_POSIX_TO_WIN_A /* from is char *posix, to is char
*win32 */ CCP_POSIX_TO_WIN_W, /* from is char *posix, to is
wchar_t *win32 */ CCP_WIN_A_TO_POSIX, /* from is char *win32,
to is char *posix */ CCP_WIN_W_TO_POSIX, /* from is wchar_t
*win32, to is char *posix */ You can additionally or the following
values to what, to define whether you want the resulting path in to to
be absolute or if you want to keep relative paths in relative notation.
Creating absolute paths is the default. CCP_ABSOLUTE = 0, /*
Request absolute path (default). */ CCP_RELATIVE = 0x100
/* Request to keep path relative. */ size is the size of
the buffer pointed to by to in bytes. If sizeis 0, cygwin_conv_path
( just returns the required buffer size in bytes. Otherwise, it
returns 0 on success, or -1 on error and errno is set to one of the
below values. EINVAL what has an invalid value. EFAULT
from or to point into nirvana. ENAMETOOLONG the resulting path is
longer than 32K, or, in case of what ==
CCP_POSIX_TO_WIN_A, longer than MAX_PATH. ENOSPC size is
less than required for the conversion.
EXAMPLE
/* Conversion from incoming Win32 path given as wchar_t *win32 to POSIX
path.
If incoming path is a relative path, stick to it. First ask how big
the output buffer has to be and allocate space dynamically. */
ssize_t size;
char *posix;
size = cygwin_conv_path (CCP_WIN_W_TO_POSIX | CCP_RELATIVE, win32,
NULL, 0);
perror ("cygwin_conv_path");
else
{
posix = (char *) malloc (size);
if (cygwin_conv_path (CCP_WIN_W_TO_POSIX | CCP_RELATIVE, win32,
posix, size))
perror ("cygwin_conv_path");
}
]]>
COPYRIGHT
Cygwin is Copyright (C) 1995-2010 Red Hat, Inc.
Cygwin is Free software; for complete licensing information, refer to:
http://cygwin.com/licensing.html
SEE ALSO
The full documentation to the Cygwin API is maintained on the web at:
http://cygwin.com/cygwin-api/cygwin-api.html
The website is updated more frequently than the man pages and should be
considered the authoritative source of information.
Cygwin April 2010 cygwin_conv_path(3)