示例#1
0
文件: io.cs 项目: stevewpalmer/jcom
 /// <summary>
 /// WRITE keyword
 /// Writes an integer 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="intVar">An integer 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, int intVar)
 {
     if (writeManager == null) {
         throw new ArgumentNullException("writeManager");
     }
     int charsWritten = writeManager.WriteInteger(intVar);
     if (charsWritten == -1) {
         iostat = IOError.WriteError;
     }
     return charsWritten;
 }
示例#2
0
文件: io.cs 项目: stevewpalmer/jcom
 /// <summary>
 /// WRITE keyword
 /// Writes an array of integer 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="intArray">An array of integers 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, int [] intArray)
 {
     if (writeManager == null) {
         throw new ArgumentNullException("writeManager");
     }
     int totalCharsWritten = 0;
     foreach (int intVar in intArray) {
         int charsWritten = writeManager.WriteInteger(intVar);
         if (charsWritten == -1) {
             iostat = IOError.WriteError;
             return -1;
         }
         totalCharsWritten += charsWritten;
     }
     return totalCharsWritten;
 }