Lugaru's Epsilon
Programmer's
Editor

Context:
Epsilon User's Manual and Reference
   Primitives and EEL Subroutines
      . . .
      Operating System Primitives
         System Primitives
         Window System Primitives
         Timing
         Calling Windows DLLs
         Running a Process
      Control Primitives
         . . .
         Examining Strings
         Modifying Strings
         Byte Arrays
         Memory Allocation
         The Name Table
         . . .
      Input Primitives
         Keys
         The Mouse
         Window Events
         . . .
         Binding Primitives
      . . .

Previous   Up    Next
Modifying Strings  Primitives and EEL Subroutines   Memory Allocation


Epsilon User's Manual and Reference > Primitives and EEL Subroutines > Control Primitives >

Byte Arrays

These functions operate on 8-bit byte arrays, not 16-bit characters.

int memcmp(byte *str1, byte *str2, int num)
int memfcmp(byte *str1, byte *str2, int num)

memcpy(byte *tostr, byte *fromstr, int num)
memset(byte *ptr, char value, int count)

The memcmp( ) and memfcmp( ) primitives compare 8-bit bytes, not 16-bit characters like the compare_chars( ) and strcmp( ) primitives do. The memfcmp( ) primitive ignores case, memcmp( ) doesn't. They return values like the others, and don't stop comparing when an array element has a zero value, as strcmp( ) does.

The memcpy( ) primitive copies exactly num bytes from the second byte array to the first.

The memset( ) primitive sets all the count bytes in a byte array ptr to the given value.

chars_to_bytes(byte *b, char *s)
bytes_to_chars(char *s, byte *b)

The chars_to_bytes( ) function copies the null-terminated character string s to the byte array b, discarding the upper 8 bits of each 16-bit character.

The bytes_to_chars( ) function copies the null-terminated byte string b to the character array s.



Previous   Up    Next
Modifying Strings  Primitives and EEL Subroutines   Memory Allocation


Lugaru Copyright (C) 1984, 2020 by Lugaru Software Ltd. All rights reserved.