why always fopen fails?

3 Ansichten (letzte 30 Tage)
Aniya
Aniya am 22 Okt. 2016
Beantwortet: Jan am 22 Okt. 2016
in_file = fopen('name_of_file', 'wt');
It is my code i used to open a file .but it always return file identifier as -1.Why? Thank you for help.

Akzeptierte Antwort

Jan
Jan am 22 Okt. 2016
Most likely you do not have write permissions in the current folder. Use a folder with write permissions and absolute file names:
in_file = fopen(fullfile(tempdir, 'name_of_file'), 'wt');

Weitere Antworten (0)

Kategorien

Mehr zu Low-Level File I/O finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by