5/7/2018 4:57 PM | |
Posts: 6 Rating: (1) |
Hi Denilson, I need to read/write several datablocks using the funciont FileReadC/FileWriteC. But I want to do in a loop (in SCL) as shown below. The tag #data_block_name should change according to the "i". value. The problem is that we cannot create an array of a Variant. Do you have any suggestion? FOR #i := 0 TO 19 DO #FileReadC_SFB_Instance(REQ := #Request_Read, Name := #DataBlock_Filename[#i+1], Offset := 0, Length := 0, Data := #data_block_name); END_FOR; Thanks, Ricardo ------------------------------------------------------------------------------------------ |
Last edited by: Jen_Moderator at: 5/8/2018 11:49:02 AMNew subject after splitting |
|
5/8/2018 8:58 PM | |||
Joined: 7/7/2010 Last visit: 4/19/2024 Posts: 14595 Rating: (2347)
|
I am not sure if one could contrive a control scheme where you can use these Runtime instructions to retrieve the string name of the DB for assigning as the text file's name: It seems like quite a stretch. However some clever programmers may be able to discover a way to obtain the name of any random DB simply by providing the DB #. Maybe via some contrived FB call using that random DB as it's instance DB.
|
||
science guy |
|||
5/9/2018 5:26 PM | |
Posts: 2826 Rating: (684) |
Hello.
@ferrazrp:
--- @huggy_d1: My idea is to have the "data" parameter write to a known and fixed byte array. The amount of bytes being written / read can be controlled by the length (and offset). The fixed byte array can in turn read from / write to the actual target DB. The exchange can happen with POKE-BLOCK instruction. That would mean the target DB number needs to be known and the target DB needs to be non-optimized. Would this solution work? ---
@anyone: Could someone please follow through on this topic, if there is still a need. Thank you. What is said above is guesswork. I do not own Step7 Prof an therefore have no way of opening the original example. (I could however make a rough PDF print.) Regards. |
Last edited by: #dP at: 5/9/2018 5:28:04 PMLast edited by: #dP at: 5/9/2018 7:11:58 PMBetter wording to request from someone to help out on this topic. |
|
Follow us on