FM_WRITE
Àðãóìåíòû:
ID INT íîìåð ôàéëà: âîçâðàùåííûé ôóíêöèåé F_ROPEN
IN MSG ñîîáùåíèå, êîòîðîå íàäî çàïèñàòü â ôàéë
ok BOO ñòàòóñ âûïîëíåíèÿ
TRUE åñëè óñïåøíî
Îïèñàíèå:
Çàïèñûâàåò ñòðîêîâûå ïåðåìåííûå â äâîè÷íûé ôàéë. Äîëæíà èñïîëüçîâàòüñÿ ñ F_WOPEN è F_CLOSE. Ýòà ôóíêöèÿ îñóùåñòâëÿåò ïîñëåäîâàòåëüíûé äîñòóï ê ôàéëó, íà÷èíàÿ ñ ïðåäûäóùåé ïîçèöèè. Ïåðâûé âûçîâ ïîñëå F_WOPEN çàïèñûâàåò ïåðâóþ ñòðîêó ôàéëà, êàæäûé âûçîâ ñäâèãàåò óêàçàòåëü çàïèñè. Ýòà ôóíêöèÿ íå âêëþ÷åíà â ñèìóëÿòîð ISaGRAF.
(*FBD ïðîãðàììà, èñïîëüçóþùàÿ áëîêè óïðàâëåíèÿ ôàéëîì*)
(* ST Ýêâèâàëåíò: *)
file_id := F_WOPEN('trace.txt');
ok := FM_WRITE(file_id,'First message');
ok := FM_WRITE(file_id,'Last message');
ok := F_CLOSE(file_id);
(* IL Ýêâèâàëåíò: *)
LD 'trace.txt'
F_WOPEN
ST file_id
FM_WRITE 'First message' (*ïèñàòü ïåðâîå ñîîáùåíèå *)
ST ok
LD file_id
FM_WRITE 'Last message' (* ïèñàòü âòîðîå ñîîáùåíèå *)
ST ok
LD file_id
F_CLOSE
ST ok