Re: Byte Arrays in VFP

2023-05-02 Thread Eric Selje
Coincidentally as I was preparing my VFP2C32 presentation just now for next
week's Virtual Fox Fest, I was reading about the Windows API's support for
memory mapped files.

"Memory-mapped files: The Windows API also provides support for
memory-mapped files, which allow developers to map a file directly into
memory and access it as if it were an array."

I'm going to see if I can contrive an example of how to do this in VFP.

Eric

On Tue, May 2, 2023 at 8:31 AM Eric Selje  wrote:

> Couldn't you leave the file on disk and make the changes directly to the
> file with low level file functions
> ?
>
> Eric
>
> On Mon, May 1, 2023 at 9:33 PM Joe Yoder  wrote:
>
>> I want to pull a 3.5 meg file into a Byte Array in Fox, make some changes
>> to individual bytes, and write the array back to another file.
>>
>> The only way I have found to do so is to build the array one character at
>> a
>> time.  Is there a better way to do this?
>>
>> Thanks in advance for any input ,
>>
>> Joe
>>
>>
>> --- StripMime Report -- processed MIME parts ---
>> multipart/alternative
>>   text/plain (text body -- kept)
>>   text/html
>> ---
>>
[excessive quoting removed by server]

___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message: 
https://leafe.com/archives/byMID/CAAwxvUmUEqQVHHwooaX8Ug+PwxGDNO2x=hfbsxb62nuetkz...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Re: Byte Arrays in VFP

2023-05-02 Thread Eric Selje
Couldn't you leave the file on disk and make the changes directly to the
file with low level file functions
?

Eric

On Mon, May 1, 2023 at 9:33 PM Joe Yoder  wrote:

> I want to pull a 3.5 meg file into a Byte Array in Fox, make some changes
> to individual bytes, and write the array back to another file.
>
> The only way I have found to do so is to build the array one character at a
> time.  Is there a better way to do this?
>
> Thanks in advance for any input ,
>
> Joe
>
>
> --- StripMime Report -- processed MIME parts ---
> multipart/alternative
>   text/plain (text body -- kept)
>   text/html
> ---
>
[excessive quoting removed by server]

___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message: 
https://leafe.com/archives/byMID/CAAwxvUnzfUnQQZaBdbBRYic9sEr-Mp4Wf+nofSyNc=+qrmy...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

AW: Byte Arrays in VFP

2023-05-02 Thread Jürgen Wondzinski
A "ByteArray" is just a stream of Bytes (i.e. a file) and you can address
any position directly by offset.

cBytes = FileToStr(Getfile())
? LEN(cBytes)

cBytes = STUFF(cBytes, 5648, 5, "Hello")
&& replace 5 Bytes at 5648 with a string; or insert or delete bytes. See
help on that STUFF  :)

StrToFile(cBytes, PutFile())&& write Bytestream back to disk with new
name


Another option is just using LLFFs (LowLevelFileFunctions):

nHandle = FOPEN(GetFile())
FSEEK(nHandle, 5648, 0)
FRWITE(nHandle, "Hello")
FCLOSE(nHandle)

wOOdy


-Ursprüngliche Nachricht-
Von: ProFox  Im Auftrag von Joe Yoder
Gesendet: Dienstag, 2. Mai 2023 04:33
An: profoxt...@leafe.com
Betreff: Byte Arrays in VFP

I want to pull a 3.5 meg file into a Byte Array in Fox, make some changes to
individual bytes, and write the array back to another file.
The only way I have found to do so is to build the array one character at a
time.  Is there a better way to do this?
Thanks in advance for any input ,

Joe


[excessive quoting removed by server]

___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message: 
https://leafe.com/archives/byMID/01b801d97cc4$0b793f70$226bbe50$@wondzinski.de
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.


Byte Arrays in VFP

2023-05-01 Thread Joe Yoder
I want to pull a 3.5 meg file into a Byte Array in Fox, make some changes
to individual bytes, and write the array back to another file.

The only way I have found to do so is to build the array one character at a
time.  Is there a better way to do this?

Thanks in advance for any input ,

Joe


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

___
Post Messages to: ProFox@leafe.com
Subscription Maintenance: https://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: https://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: https://leafe.com/archives
This message: 
https://leafe.com/archives/byMID/cabqednvr0dretczbxz4riss-tubx0oaw87chmjwosd71hsq...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.