Name

mgetstr — read a character string

Calling Sequence

str=mgetstr(n [,fd] )

Parameters

n

a positive scalar: The number of character to read.

fd

scalar. The fd parameter returned by the function mopen. -1 stands for last opened file. Default value is -1.

str

a character string

Description

mgetstr function allows to read a character string in a binary file. If EOF is reached before read completion only the properly read values will be returned.

Examples

// open file descriptor as text with read mode
fd_r = mopen(SCI+'/ACKNOWLEDGEMENTS','rt')

// get 100 characters of fd_r
strs_1 = mgetstr(100, fd_r)

// get 200 next characters of fd_r
strs_2 = mgetstr(200, fd_r)

// close file descriptor
mclose(fd_r);

See Also

mclose, meof, mfprintf, fprintfMat, mfscanf, fscanfMat, mget, mgetstr, mopen, mprintf, mput, mputstr, mscanf, mseek, mtell, mdelete