12.07.2015 Views

RAPID reference manual - Technology

RAPID reference manual - Technology

RAPID reference manual - Technology

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

InstructionOpenDirFile and Serial Channel HandlingOpenDir - Open a directoryOpenDir is used to open a directory for further investigation.ExamplePROC lsdir(string dirname)VAR dir directory;VAR string filename;OpenDir directory, dirname;WHILE ReadDir(directory, filename) DOTPWrite filename;ENDWHILECloseDir directory;ENDPROCThis example prints out the names of all files or subdirectories under the specifieddirectory.ArgumentsOpenDirDev PathDevData type: dirA variable with <strong>reference</strong> to the directory, fetch by OpenDir.This variable is then used for reading from the directory.PathData type: stringPath to the directory.LimitationsOpen directories should always be closed by the user after reading (instruction CloseDir).Error handlingIf the path points to a not existing directory or if there are too many directories open atthe same time, the system variable ERRNO is set to ERR_FILEACC. This error canthen be handled in the error handler.<strong>RAPID</strong> <strong>reference</strong> <strong>manual</strong> - part 1a, Instructions A-R 311

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!