WriteArraySeparated()
Summary
Writes the elements of an array to a file, separated by a delimiter.
Syntax
WriteArraySeparated(file file_ptr, array a, string delim, string quote)
| Argument | Contents |
|---|---|
| file_ptr | A file handle |
| a | An array of strings, numbers, and sub-arrays |
| delim | Indicates the character to use to delimit one element of the array from another in the file |
| quote | Indicates the character to use to mark the beginning and end of strings in the file |
Notes
-
Only the first character of delim and quote are used; subsequent characters are ignored.
-
If delimiter is null, the array elements are adjacent to each other in the line of the output file.
-
If quote is null, strings are not quoted in the output file.
-
As a special case, if any element of the array is a subarray, the second element of the subarray is written to the file. This is useful for writing the values of a record as returned by GetRecordValues().
-
Array elements which are not strings, numbers, or arrays are written as spaces; e.g., a null is written as a space.
Example
WriteArraySeparated(fptr, rec_vals, ",", "\"")
Error Codes
| Error Type | Meaning |
|---|---|
| Error | The file handle is invalid |
See Also
| Function | Summary |
|---|---|
| WriteArray() | Writes the elements of an array to a file |
| GetRecordValues() | Reads the values of one or more fields for a record in a view |