/// <summary> /// WRITE keyword /// Writes a boolean value to the device. /// </summary> /// <param name="writeManager">A WriteManager instance to use</param> /// <param name="iostat">A reference variable that will be set to the I/O status</param> /// <param name="boolVar">A boolean value to write</param> /// <returns>A zero value if the operation succeeds, or -1 if the operation fails</returns> public static int WRITE(WriteManager writeManager, ref int iostat, bool boolVar) { if (writeManager == null) { throw new ArgumentNullException("writeManager"); } int charsWritten = writeManager.WriteBoolean(boolVar); if (charsWritten == -1) { iostat = IOError.WriteError; } return charsWritten; }
/// <summary> /// WRITE keyword /// Writes an array of boolean values to the device. /// </summary> /// <param name="writeManager">A WriteManager instance to use</param> /// <param name="iostat">A reference variable that will be set to the I/O status</param> /// <param name="boolArray">An array of booleans to write</param> /// <returns>A zero value if the operation succeeds, or -1 if the operation fails</returns> public static int WRITE(WriteManager writeManager, ref int iostat, bool [] boolArray) { if (writeManager == null) { throw new ArgumentNullException("writeManager"); } int totalCharsWritten = 0; foreach (bool boolVar in boolArray) { int charsWritten = writeManager.WriteBoolean(boolVar); if (charsWritten == -1) { iostat = IOError.WriteError; return -1; } totalCharsWritten += charsWritten; } return totalCharsWritten; }