ISaGRAF. Version 3.4

         

F_EOF


Àðãóìåíòû:

ID                         INT                 íîìåð ôàéëà: âîçâðàùåííûé ôóíêöèÿìè F_ROPEN èëè F_WOPEN

ok                        BOO              èíäèêàòîð êîíöà ôàéëà

                                                  TRUE åñëè êîíåö ôàéë áûë äîñòèãíóò ïðè ïîñëåäíåì ÷òåíèè èëè çàïèñè

FM_READ ïîñëåäíåå ñîîáùåíèå ïðî÷èòàííîå èç ôàéëà ìîæåò áûòü íåâåðíûì, åñëè ïîñëåäíèé ñèìâîë -

                                                  íå ñèìâîë îêîí÷àíèÿ ñòðîêè

Îïèñàíèå:

Ïðîâåðÿåò äîñòèãíóò ëè êîíåö ôàéëà.  Ýòà ôóíêöèÿ íå âêëþ÷åíà â ñèìóëÿòîð ISaGRAF.

(*FBD ïðîãðàììà, èñïîëüçóþùàÿ áëîêè óïðàâëåíèÿ ôàéëîì*)

(* ST Ýêâèâàëåíò: *)

file_id := F_ROPEN('data.bin');

WHILE not(F_EOF(file_id))

VAL := FA_READ(file_id);

END_WHILE;

MESSAGE := 'last val = ' + msg(VAL);

ok := F_CLOSE(file_id);

(* IL Ýêâèâàëåíò: *)

                         LD              'data.bin'

                         F_ROPEN

                         ST              file_id

                         LD              file_id

                         F_EOF

                         JMPC          END_OF_FILE

NOT_EOF:         LD              file_id

                         FA_READ  

                         ST              VAL

                         LD              file_id

                         F_EOF

                         JMPNC        NOT_EOF   (* åñëè íå eof, òî ÷èòàòü*)

END_OF_FILE:  LD              VAL

                         MSG

                         ST              val_msg                     (* ïðåâðàùåíèå VAL â ñòðîêó *)

                         LD              'last val = '

                         ADD           val_msg

                         ST              MESSAGE

                         LD              file_id

                         F_CLOSE

                         ST              ok



Ñîäåðæàíèå ðàçäåëà