38 #define G_OPEN "GUrlFile::open(std::string&, std::string&)"
215 m_fptr = std::fopen(filename.c_str(), mode.c_str());
217 std::string msg =
"Unable to open file \""+filename+
"\" in mode \""+
218 mode+
"\". Please specify an accessible file.";
282 if (buffer != NULL && nbyte > 0) {
283 nread = std::fread(buffer, 1, nbyte,
m_fptr);
323 if (buffer != NULL && nbyte > 0) {
324 nwritten = std::fwrite(buffer, 1, nbyte,
m_fptr);
359 character = std::fgetc(
m_fptr);
383 std::fputc(character,
m_fptr);
411 std::va_list arg_ptr;
414 va_start(arg_ptr, format);
417 vfscanf(
m_fptr, format, arg_ptr);
451 std::va_list arg_ptr;
454 va_start(arg_ptr, format);
457 std::vfprintf(
m_fptr, format, arg_ptr);
484 result.append(
"=== GUrlFile ===");
490 int pos = std::ftell(
m_fptr);
491 int err = std::ferror(
m_fptr);
500 result.append(
"none");
std::string m_mode
File mode.
virtual void clear(void)
Clear instance.
GUrlFile(void)
Void constructor.
void free_members(void)
Delete class members.
GUrlFile & operator=(const GUrlFile &url)
Assignment operator.
GUrl & operator=(const GUrl &url)
Assignment operator.
virtual int write(const void *buffer, const int &nbyte)
Write block of data buffer into file.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print URL information.
File URL class interface definition.
virtual ~GUrlFile(void)
Destructor.
std::string m_url
File URL.
virtual void close(void)
Close file.
virtual void open(const std::string &url, const std::string &mode)
Open file.
void free_members(void)
Delete class members.
virtual void printf(const char *format,...)
Write formatted data into file.
void copy_members(const GUrlFile &url)
Copy class members.
virtual void scanf(const char *format,...)
Read formatted data from file.
virtual int get_char(void) const
Return next character from file.
virtual GUrlFile * clone(void) const
Clone instance.
virtual int read(void *buffer, const int &nbyte)
Read block of data from file in buffer.
virtual void put_char(const int &character)
Write character into file.
Exception handler interface definition.
std::string expand_env(const std::string &arg)
Expand environment variables in string.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
void init_members(void)
Initialise class members.
void init_members(void)
Initialise class members.
FILE * m_fptr
File pointer.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.