SimGrid  3.7
Scalable simulation of distributed systems
Typedefs | Functions
File Management Functions
MSG

This section describes the file structure of MSG (msg_file_t) and the functions for managing it. It is based on POSIX functions. More...

Typedefs

typedef struct msg_file * msg_file_t
 File datatype.You should consider this as an opaque object.

Functions

size_t MSG_file_read (const char *storage, void *ptr, size_t size, size_t nmemb, msg_file_t stream)
 Read elements of a file.
size_t MSG_file_write (const char *storage, const void *ptr, size_t size, size_t nmemb, msg_file_t stream)
 Write elements into a file.
msg_file_t MSG_file_open (const char *storage, const char *path, const char *mode)
 Opens the file whose name is the string pointed to by path.
int MSG_file_close (const char *storage, msg_file_t fp)
 Close the file.
int MSG_file_stat (const char *storage, msg_file_t fd, s_msg_stat_t *buf)
 Stats the file pointed by fd.

Detailed Description

This section describes the file structure of MSG (msg_file_t) and the functions for managing it. It is based on POSIX functions.

(msg_file_t) and the functions for managing it.

See also:
msg_file_t

Function Documentation

size_t MSG_file_read ( const char *  storage,
void *  ptr,
size_t  size,
size_t  nmemb,
msg_file_t  stream 
)

Read elements of a file.

Parameters:
storageis the name where find the stream
ptrbuffer to where the data is copied
sizeof each element
nmembis the number of elements of data to read
streamto read
Returns:
the number of items successfully read
size_t MSG_file_write ( const char *  storage,
const void *  ptr,
size_t  size,
size_t  nmemb,
msg_file_t  stream 
)

Write elements into a file.

Parameters:
storageis the name where find the stream
ptrbuffer from where the data is copied
sizeof each element
nmembis the number of elements of data to write
streamto write
Returns:
the number of items successfully write
msg_file_t MSG_file_open ( const char *  storage,
const char *  path,
const char *  mode 
)

Opens the file whose name is the string pointed to by path.

Parameters:
storageis the name where find the file to open
pathis the file location on the storage
modepoints to a string beginning with one of the following sequences (Additional characters may follow these sequences.): r Open text file for reading. The stream is positioned at the beginning of the file. r+ Open for reading and writing. The stream is positioned at the beginning of the file. w Truncate file to zero length or create text file for writing. The stream is positioned at the beginning of the file. w+ Open for reading and writing. The file is created if it does not exist, otherwise it is truncated. The stream is positioned at the beginning of the file. a Open for appending (writing at end of file). The file is created if it does not exist. The stream is positioned at the end of the file. a+ Open for reading and appending (writing at end of file). The file is created if it does not exist. The initial file position for reading is at the beginning of the file, but output is always appended to the end of the file.
Returns:
An msg_file_t associated to the file
int MSG_file_close ( const char *  storage,
msg_file_t  fp 
)

Close the file.

Parameters:
storageis the name where find the stream
fpis the file to close
Returns:
0 on success or 1 on error
int MSG_file_stat ( const char *  storage,
msg_file_t  fd,
s_msg_stat_t *  buf 
)

Stats the file pointed by fd.

Parameters:
storageis the name where find the stream
fdis the file descriptor (msg_file_t)
bufis the return structure with informations
Returns:
0 on success or 1 on error


Back to the main Simgrid Documentation page The version of SimGrid documented here is v3.7.
Documentation of other versions can be found in their respective archive files (directory doc/html).
Generated by doxygen