getArrayAddress

Requires FM 1.0 Beta 8.4 (Sep 2007) or newer

Syntax

INT_PTR getArrayAddress(int arraynr)

Arguments

arraynr
The number of the built-in FM array that you want a pointer to.

Return

Returns a C-language memory address pointer to the given FM array.

Description

Returns the memory address of the requested built-in FM array. FilterMeister provides up to 100 in-built arrays numbered from 0-99. You might need to use this if working with the built-in arrays in conjunction with C language functions.

Example

%fml

Title:    "Test copyResToArray"
Category: "FM Example Code"
Embed:    Other="test.txt"

// Make a control to display text on the interface
ctl[10]: STATICTEXT, Size=(100, 40), Text="This text will be replaced"

OnFilterStart: {

  bool loaded = false;

  // Load the test.txt file embedded in the plugin into Array #0
  loaded = copyResToArray("FMDATA", "test.txt", 0);

  // If the resource loaded, copy the (max) first 255 characters
  // into an internal string variable, so it correctly ends
  // with a zero byte to mark the end of string
  if (loaded) {
    strncpy(str1, getArrayAddress(0), 255);
  }
  else {
    strncpy(str1, "Could not find test.txt file", 255);
  }

  // Set control #10 to be labelled with the contents of str1
  setCtlText(10, str1);

  return true;
}

See Also

allocArray, copyResToArray, getArray, freeArray

Comments

Everyone can add their comments about their experiences with this function here. Tips for using it are welcome, too.