When I open an existing file and a start to rewrite content to the file (and overwrite the old content) then the leftover old content, not overwritten, stays in the file. Is it possible to give an End-Of-File sign or something when I finished the writing of new content, so the old leftover text will be lost? Marco van Os GeoComfort
Hello Marco van Os, may be the following procedure can help: 1. Open the File via FB FILE_OPEN 2. Determine the current position of the file pointer in a file via FB FILE_TELL 3. Move the current file pointer to a new position via FB FILE_SEEK ( with parameters: 0, other values: Positioning relative to start of file. 1 Positioning relative to current position. 2 Positioning relative to end of file. ) 4. Provide the Handle to the FB FILE_WRITE Best Regards Eduard
Hi Eduard, Thanks for your reaction. But what do i have to do with the FILE_WRITE? Because at that point were the filepointer is, the end of the file should be inserted. All other leftover text behind te pointer must disappear? I do not know how to force this. Marco
Hello Marco, I can’t reproduce the following case: When I open an existing file and a start to rewrite content to the file (and overwrite the old content) then the leftover old content, not overwritten, stays in the file. My Testproject (see server link) executes following steps: 1. Open and write into file following content: strSource := STRING#‘{“question”:“What is the meaning of life, the universe and everything? This text is longer than 80 characters, so …”, “answer”:42, “avagadros.number”:6.02E23, “apple.pi”:3.14159, “apple”:{“pi”:3}, “MØllerSchlüssel”:“äöü”}’; 2. Open file and overwrite it with following content: strSource := STRING#‘{“question”:"What is the meaning of life, the universe and everything?’; Result/File content: {“question”:"What is the meaning of life, the universe and everything? Please see project and result file under following server link: Adresse:\thttps://extrans.phoenixcontact.com/extrans2/index.jsp?id=1153953703 Passwort:\th2hjnAsrJm If the example don’t help, please send me a short code example, expected result and the real result. Thanks & Best Regards Eduard