Esempio n. 1
0
 /// <summary>
 /// READ keyword
 /// Read a string from the device into a substring of the specified fixed string.
 /// </summary>
 /// <param name="readManager">A ReadManager instance to use</param>
 /// <param name="iostat">A reference variable that will be set to the I/O status</param>
 /// <param name="start">The 1-based start index of the target string</param>
 /// <param name="end">The 1-based end index of the target string</param>
 /// <param name="fixedstrVar">The fixed string identifier to read into</param>
 /// <returns>A zero value if the operation succeeds, or -1 if the operation fails</returns>
 public static int READ(ReadManager readManager, ref int iostat, int start, int end, ref FixedString fixedstrVar)
 {
     if (readManager == null) {
         throw new ArgumentNullException("readManager");
     }
     if (fixedstrVar == null) {
         throw new ArgumentNullException("fixedstrVar");
     }
     if (end == -1) {
         end = fixedstrVar.Length;
     }
     FixedString fixedString = new FixedString((end - start) + 1);
     int charsRead = readManager.ReadString(ref fixedString);
     if (charsRead == -1) {
         iostat = IOError.ReadError;
     } else {
         fixedstrVar.Set(fixedString, start - 1, end - 1);
     }
     return charsRead;
 }
Esempio n. 2
0
 /// <summary>
 /// READ keyword
 /// Read a string from the device into the specified identifier.
 /// </summary>
 /// <param name="readManager">A ReadManager instance to use</param>
 /// <param name="iostat">A reference variable that will be set to the I/O status</param>
 /// <param name="fixedstrVar">The fixed string identifier to read into</param>
 /// <returns>A zero value if the operation succeeds, or -1 if the operation fails</returns>
 public static int READ(ReadManager readManager, ref int iostat, ref FixedString fixedstrVar)
 {
     if (readManager == null) {
         throw new ArgumentNullException("readManager");
     }
     if (fixedstrVar == null) {
         throw new ArgumentNullException("fixedstrVar");
     }
     int charsRead = readManager.ReadString(ref fixedstrVar);
     if (charsRead == -1) {
         iostat = IOError.ReadError;
     }
     return charsRead;
 }