WriteMemory - Write a string to memory

Top  Previous  Next

Syntax

 

<cString> := WriteMemory( <nLongStartAddress>, <cDataString>, <nByteCount> )

 

Parameters

 

<nLongStartAddress>

 

A LONG value specifying the start address where the data is to be written in memory.

 

<cDataString>

 

Data string to write to memory starting at address <nLongStartAddress>. <cDataString> must contain at least as many characters as <nByteCount> indicates.

 

<nByteCount>

 

Number of bytes to write to memory. This parameter is not optional. The maximum value for <nByteCount> is the length of  <cDataString>.

 

Return value

 

Always NIL.

 

Description

 

WriteMemory writes a block of bytes from a string to memory. The start address of the target memory block is given in <nLongStartAddress> and its size is specified by <nByteCount>. Make sure the address is correct and that you have write access to the complete range of bytes you are about to write to.

 

Classification

 

Core

 

Category

 

Pointers and Memory

 

Quick Info

 

Library: cckptcor.lib / cckptcor.dll

 

See also

 

ReadMemory

 

Example

 

 

#INCLUDE "CockpitCoreLibs.ch"

 

FUNCTION Main

 

LOCAL address

 

* Allocate some memory

address := LockNullString(10)

 

* Write some data to this memory range

WriteMemory(address,"Here we go",10)

 

* Check if everything worked fine

? ReadMemory(address,10)

 

RETURN NIL