1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-01 15:00:38 +00:00
QB64-PE/internal/help/_MEMFILL.txt

50 lines
1.7 KiB
Plaintext
Raw Normal View History

2016-03-18 11:36:04 +00:00
{{DISPLAYTITLE:_MEMFILL}}
2017-10-10 14:55:21 +00:00
The [[_MEMFILL]] statement converts a value to a specified type, then fills memory with that type including any non-whole remainder.
{{PageSyntax}}
2017-10-10 14:55:21 +00:00
: [[_MEMFILL]] {{Parameter|memoryBlock}}, {{Parameter|memoryBlock.OFFSET}}, {{Parameter|fillBytes}}, {{Parameter|value}} [AS {{Parameter|variableType}}]
{{Parameters}}
2017-10-10 14:55:21 +00:00
* The {{Parameter|memoryBlock}} [[_MEM]] memory block is the block referenced to be filled.
* {{Parameter|memoryBlock.OFFSET}} is the starting offset of the above referenced memory block.
* The {{Parameter|fillBytes}} is the number of bytes to fill the memory block.
* The {{Parameter|value}} is the value to place in the memory block at the designated OFFSET position.
* A literal or variable {{Parameter|value}} can be optionally set [[AS]] a variable [[type]] appropriate for the memory block.
2017-10-10 14:55:21 +00:00
{{PageDescription}}
* To clear previous data from a [[_MEMNEW]] memory block, use _MEMFILL with a {{Parameter|value}} of 0.
2016-03-18 11:36:04 +00:00
2017-10-10 14:55:21 +00:00
{{PageExamples}}
2016-03-18 11:36:04 +00:00
''Example:'' Filling array values quickly using FOR loops or a simple memory fill.
{{CodeStart}} '' ''
{{Cl|DIM}} a(100, 100) {{Cl|AS}} {{Cl|LONG}}
{{Cl|DIM}} b(100, 100) {{Cl|AS}} {{Cl|LONG}}
'filling array a with value 13
{{Cl|FOR...NEXT|FOR}} i1 = 0 {{Cl|TO}} 100
{{Cl|FOR...NEXT|FOR}} i2 = 0 {{Cl|TO}} 100
a(i1, i2) = 13
{{Cl|NEXT}}
{{Cl|NEXT}}
2016-03-18 11:36:04 +00:00
'filling array b with value 13
{{Cl|DIM}} mema {{Cl|AS}} {{Cl|_MEM}}
2016-03-18 11:36:04 +00:00
mema = {{Cl|_MEM (function)|_MEM}}(b())
{{Cl|_MEMFILL}} mema, mema.OFFSET, mema.SIZE, 13 {{Cl|AS}} {{Cl|LONG}}
{{Cl|_MEMFREE}} mema '' ''
{{CodeEnd}}
2017-10-10 14:55:21 +00:00
{{PageSeeAlso}}
2016-03-18 11:36:04 +00:00
* [[_MEM]], [[_MEM (function)]]
* [[_MEMIMAGE]], [[_MEMNEW]]
* [[_MEMGET]], [[_MEMPUT]]
2019-04-15 01:15:33 +00:00
{{PageNavigation}}
<