Hi Ben
I wrote a testprogram for the build in function File.
It's working fast and with long filename.
Only create with the file and close the file there is a little problem.
So I first have to start the program with creat file and then close the program and switch off createfile when the program second time runs.
I also have to close the app before I can open the file in windows. But the file is written extremely quickly
regards
Stefan
file on windows:
App Developer build in function File
-
- Valued Contributor
- Posts: 760
- http://meble-kuchenne.info.pl
- Joined: Wed Dec 02, 2020 10:53 am
- Has thanked: 150 times
- Been thanked: 171 times
App Developer build in function File
- Attachments
-
- FC9_HX711_monitor_1.fcsx
- (11.63 KiB) Downloaded 328 times
-
- Matrix Staff
- Posts: 1756
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 446 times
- Been thanked: 606 times
Re: App Developer build in function File
Hi Stefan,
If you first try to open the file, then if this fails you can then create the file. This shuold save you going back and having to remove the create file on the second pass.
Regarding the file being locked while flowcode is open, if you call the close macro then the file should be available as soon as the write is complete.
If you first try to open the file, then if this fails you can then create the file. This shuold save you going back and having to remove the create file on the second pass.
Regarding the file being locked while flowcode is open, if you call the close macro then the file should be available as soon as the write is complete.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
-
- Matrix Staff
- Posts: 1756
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 446 times
- Been thanked: 606 times
Re: App Developer build in function File
Aha sorry Steve just pointed out your using the API calls directly and not the file component.
In this case you can call the flush API call to force any pending writes to be completed and then set the file handle to 0 to effectively close the file.
I also didn't add that creating the file will also open the file and so the logic should be like this.
check = FileOpen
if check = false
{
FileCreate
}
Write to file
FileClose
In this case you can call the flush API call to force any pending writes to be completed and then set the file handle to 0 to effectively close the file.
I also didn't add that creating the file will also open the file and so the logic should be like this.
check = FileOpen
if check = false
{
FileCreate
}
Write to file
FileClose
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
-
- Matrix Staff
- Posts: 1269
- Joined: Sat Dec 05, 2020 10:32 am
- Has thanked: 169 times
- Been thanked: 285 times
-
- Valued Contributor
- Posts: 760
- Joined: Wed Dec 02, 2020 10:53 am
- Has thanked: 150 times
- Been thanked: 171 times
Re: App Developer build in function File
Hi Ben, Hi Steve
Thanks a lot.It's working fine now.
With the part "if file not can be open, then create", I understand.
And that there is no command macro for file close so I use file open but with parameter 0 for read and write.
I suppose that's what Ben means.
I will continue to save and open large amounts of data in arrays.
regards
Stefan
to close the file
Thanks a lot.It's working fine now.
With the part "if file not can be open, then create", I understand.
And that there is no command macro for file close so I use file open but with parameter 0 for read and write.
I suppose that's what Ben means.
I will continue to save and open large amounts of data in arrays.
regards
Stefan
to close the file
-
- Matrix Staff
- Posts: 1269
- Joined: Sat Dec 05, 2020 10:32 am
- Has thanked: 169 times
- Been thanked: 285 times
Re: App Developer build in function File
Use the "flush" API call to close the file for reading/writing as in the example.stefan.erni wrote: ↑Wed Sep 21, 2022 12:59 pmAnd that there is no command macro for file close so I use file open but with parameter 0 for read and write.
-
- Valued Contributor
- Posts: 760
- Joined: Wed Dec 02, 2020 10:53 am
- Has thanked: 150 times
- Been thanked: 171 times
Re: App Developer build in function File
Hi Steve
If I use the example with the flush I get this message. So I have to close FC and then I can open the file.
I don't know exactly what I'm doing wrong that it doesn't work for me on my computer.
regards
Stefan
If I use the example with the flush I get this message. So I have to close FC and then I can open the file.
I don't know exactly what I'm doing wrong that it doesn't work for me on my computer.
regards
Stefan
-
- Valued Contributor
- Posts: 760
- Joined: Wed Dec 02, 2020 10:53 am
- Has thanked: 150 times
- Been thanked: 171 times
Re: App Developer build in function File
Hi Steve
Now it's working nice to close the file.
As you wrote flush and open with 0,0,0
regards
Stefan
Now it's working nice to close the file.
As you wrote flush and open with 0,0,0
regards
Stefan
- Attachments
-
- Snag_6e7ebe.png (24.4 KiB) Viewed 5374 times