# gdcm::System Class Reference

Class to do system operation. More...

`#include <gdcmSystem.h>`

List of all members.

## Static Public Member Functions
static size_t | EncodeBytes (char *out, const unsigned char *data, int size)
| Encode bytes.
static bool | FileExists (const char *filename)
| Check whether the specified file exist on the sytem.
static bool | FileIsDirectory (const char *name)
| Check whether the file specified is a directory:
static size_t | FileSize (const char *filename)
static time_t | FileTime (const char *filename)
static bool | FormatDateTime (char date[22], time_t t, long milliseconds=0)
static bool | GetCurrentDateTime (char date[22])
| Return the current data time, and format it as ASCII text.
static const char * | GetCurrentModuleFileName ()
static const char * | GetCurrentProcessFileName ()
static const char * | GetCurrentResourcesDirectory ()
static const char * | GetCWD ()
static bool | GetHardwareAddress (unsigned char addr[6])
static bool | GetHostName (char hostname[255])
static const char * | GetLastSystemError ()
| Return the last error.
static bool | MakeDirectory (const char *path)
| Create a directory.
static bool | ParseDateTime (time_t &timep, long &milliseconds, const char date[22])
static bool | ParseDateTime (time_t &timep, const char date[22])
| Parse a date stored as ASCII text into a time_t structured (discard millisecond if any).
static bool | RemoveFile (const char *source)
| remove a file
static int | StrCaseCmp (const char *s1, const char *s2)
| consistant func for C99 spec of strcasecmp/strncasecmp
static int | StrNCaseCmp (const char *s1, const char *s2, size_t n)
## Static Protected Member Functions
static bool | GetPermissions (const char *file, unsigned short &mode)
| NOT THREAD SAFE.
static bool | SetPermissions (const char *file, unsigned short mode)

## Detailed Description

Class to do system operation.

OS independant functionalities

## Member Function Documentation

static size_t gdcm::System::EncodeBytes | ( | char * | out,
|  | const unsigned char * | data,
|  | int | size |
| ) |  |  | `[static]`

Encode bytes.

static bool gdcm::System::FileExists | ( | const char * | filename | ) | `[static]`

Check whether the specified file exist on the sytem.

Examples:
  EncapsulateFileInRawData.cxx.

static bool gdcm::System::FileIsDirectory | ( | const char * | name | ) | `[static]`

Check whether the file specified is a directory:

static size_t gdcm::System::FileSize | ( | const char * | filename | ) | `[static]`

Return the filesize. 0 if file does not exist.

Warning:
  you need to use FileExists to differenciate between empty file and missing file.
  for very large size file and on system where size_t is not appropriate to store off_t value the function will return 0.

Examples:
  CheckBigEndianBug.cxx, CreateARGBImage.cxx, CreateCMYKImage.cxx, and EncapsulateFileInRawData.cxx.

static time_t gdcm::System::FileTime | ( | const char * | filename | ) | `[static]`

Return the time of last modification of file 0 if the file does not exist

static bool gdcm::System::FormatDateTime | ( | char | date[22],
|  | time_t | t,
|  | long | milliseconds = `0` |
| ) |  |  | `[static]`

format as ASCII text a time_t with milliseconds See VR::DT from DICOM PS 3.5 milliseconds is in the range [0, 999999]

static bool gdcm::System::GetCurrentDateTime | ( | char | date[22] | ) | `[static]`

Return the current data time, and format it as ASCII text.

static const char* gdcm::System::GetCurrentModuleFileName | ( |  | ) | `[static]`

Return the directory the current module is located: NOT THREAD SAFE

static const char* gdcm::System::GetCurrentProcessFileName | ( |  | ) | `[static]`

Return the directory the current process (executable) is located: NOT THREAD SAFE

static const char* gdcm::System::GetCurrentResourcesDirectory | ( |  | ) | `[static]`

On some system (Apple) return the path to the current bundled 'Resources' directory NOT THREAD SAFE

static const char* gdcm::System::GetCWD | ( |  | ) | `[static]`

Return current working directory Warning: if current working path is too long (>2048 bytes) the call will fail and call will return NULL NOT THREAD SAFE

static bool gdcm::System::GetHardwareAddress | ( | unsigned char | addr[6] | ) | `[static]`

Deprecated:
  DO NOT USE: This function might disapear real time soon...

static bool gdcm::System::GetHostName | ( | char | hostname[255] | ) | `[static]`

Retrieve the hostname, only the first 255 byte are copyied. This may come handy to specify the Station Name

static const char* gdcm::System::GetLastSystemError | ( |  | ) | `[static]`

Return the last error.

static bool gdcm::System::GetPermissions | ( | const char * | file,
|  | unsigned short & | mode |
| ) |  |  | `[static, protected]`

NOT THREAD SAFE.

static bool gdcm::System::MakeDirectory | ( | const char * | path | ) | `[static]`

Create a directory.

static bool gdcm::System::ParseDateTime | ( | time_t & | timep,
|  | long & | milliseconds,
|  | const char | date[22] |
| ) |  |  | `[static]`

Parse a date stored as ASCII text into a time_t structured and millisecond

See also:
  FormatDateTime

static bool gdcm::System::ParseDateTime | ( | time_t & | timep,
|  | const char | date[22] |
| ) |  |  | `[static]`

Parse a date stored as ASCII text into a time_t structured (discard millisecond if any).

static bool gdcm::System::RemoveFile | ( | const char * | source | ) | `[static]`

remove a file

static bool gdcm::System::SetPermissions | ( | const char * | file,
|  | unsigned short | mode |
| ) |  |  | `[static, protected]`

static int gdcm::System::StrCaseCmp | ( | const char * | s1,
|  | const char * | s2 |
| ) |  |  | `[static]`

consistant func for C99 spec of strcasecmp/strncasecmp

Referenced by gdcm::PrivateTag::operator<().

static int gdcm::System::StrNCaseCmp | ( | const char * | s1,
|  | const char * | s2,
|  | size_t | n |
| ) |  |  | `[static]`

Precondition:
  n != 0

The documentation for this class was generated from the following file:

- gdcmSystem.h