App developer How close a file

For general Flowcode discussion that does not belong in the other sections.
Post Reply
stefan.erni
Valued Contributor
Posts: 997
http://meble-kuchenne.info.pl
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 190 times
Been thanked: 217 times

App developer How close a file

Post by stefan.erni »

Hi Ben

To write file with the App developer is very nice to do.
I think is a fast way to test files and fileheader before I use it embedded.
Is there a way to close the file in App developer?
If I write a file and open the file with wordpad or HexEditor I get a warning.

So I have to close Flowcode (not just end the App) .

regard

Stefan
warning_2021-03-11_11-02-59.png
warning_2021-03-11_11-02-59.png (11.83 KiB) Viewed 4466 times
close-file_2021-03-11_17-51-03.png
close-file_2021-03-11_17-51-03.png (168.21 KiB) Viewed 4466 times
FC9_APP_EDF_1.fcsx
(30.35 KiB) Downloaded 395 times

BenR
Matrix Staff
Posts: 1924
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 501 times
Been thanked: 684 times

Re: App developer How close a file

Post by BenR »

Hi Stefan,

For now you could try opening a file that doesn't exist and it should close the handle to the file.

I'll see if we can add a close function for you.

stefan.erni
Valued Contributor
Posts: 997
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 190 times
Been thanked: 217 times

Re: App developer How close a file

Post by stefan.erni »

Hi Ben
For now you could try opening a file that doesn't exist and it should close the handle to the file.
this is working. It's close the file.

To write a file with header and data is very comfortable with Flowcode. One question more.
When the recording is finish I have to write how many samples are recorded. How can I write (overwrite) just the first block or even the few byte with the info about the number of samples?

regards

Stefan

BenR
Matrix Staff
Posts: 1924
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 501 times
Been thanked: 684 times

Re: App developer How close a file

Post by BenR »

Hi Stefan,

Adding and Inserting data half way through a file is tricky. Ideally if you make enough room for the largest number of characters you can expect in the header then you can update the value without having to shift the rest of the file by adding new characters.

Once you open a file the first sector (512 bytes) of the file are loaded into memory. By using the ReadByteFromBuffer and WriteByteToBuffer you can read and write the sector memory loaded in RAM. Then by calling WriteFileSector you will overwrite the Filesector with the RAM buffer.

Hopefully this helps but let us know how you're getting on.

stefan.erni
Valued Contributor
Posts: 997
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 190 times
Been thanked: 217 times

Re: App developer How close a file

Post by stefan.erni »

Hi Ben

That's working fine. Thank you for this help.

regards

Stefan

number_of_sample_2021-03-19_11-22-43.png
number_of_sample_2021-03-19_11-22-43.png (175.28 KiB) Viewed 4417 times

Post Reply