A high-performance general-purpose compute library

- Main Page
- Tutorials
- Release Notes
- Examples

Functions
toString
ArrayFire Functions

Print the array to a string instead of the screen More...

## Functions
AFAPI void | toString (char **output, const char *exp, const array &arr, const int precision=4, const bool transpose=true)
AFAPI const char * | toString (const char *exp, const array &arr, const int precision=4, const bool transpose=true)
AFAPI af_err | af_array_to_string (char **output, const char *exp, const af_array arr, const int precision, const bool transpose)

## Detailed Description

Print the array to a string instead of the screen

This function is similar to af::print, except that it prints to a string rather than to screen.

## Function Documentation

## ◆ af_array_to_string()

AFAPI af_err af_array_to_string | ( | char ** | output,
|  | const char * | exp,
|  | const af_array | arr,
|  | const int | precision,
|  | const bool | transpose )

Parameters

  [out] | output | is the pointer to the c-string that will hold the data. The memory for output is allocated by the function. The user is responsible for deleting the memory.
  [in] | exp | is an expression, generally the name of the array
  [in] | arr | is the input array
  [in] | precision | is the precision length for display
  [in] | transpose | determines whether or not to transpose the array before storing it in the string

## ◆ toString() [1/2]

AFAPI void toString | ( | char ** | output,
|  | const char * | exp,
|  | const array & | arr,
|  | const int | precision = 4,
|  | const bool | transpose = true )

Parameters

  [out] | output | is the pointer to the c-string that will hold the data. The memory for output is allocated by the function. The user is responsible for deleting the memory using af::freeHost() or af_free_host().
  [in] | exp | is an expression, generally the name of the array
  [in] | arr | is the input array
  [in] | precision | is the precision length for display
  [in] | transpose | determines whether or not to transpose the array before storing it in the string

## ◆ toString() [2/2]

AFAPI const char * toString | ( | const char * | exp,
|  | const array & | arr,
|  | const int | precision = 4,
|  | const bool | transpose = true )

Parameters

  [in] | exp | is an expression, generally the name of the array
  [in] | arr | is the input array
  [in] | precision | is the precision length for display
  [in] | transpose | determines whether or not to transpose the array before storing it in the string

Returns
  output is the pointer to the c-string that will hold the data. The memory for output is allocated by the function. The user is responsible for deleting the memory using af::freeHost() or af_free_host().