Hitachi

JP1 Version 12 JP1/IT Desktop Management 2 Distribution Function Administration Guide


19.3.1 Deleting carriage return and linefeed characters

The text read from a file may contain carriage return and linefeed characters (\r\n). This subsection gives an example of reading the file that contains the text Deleted CR and LF.\r\n, deleting carriage return and linefeed characters from the text, and outputting the result to RecDFile.log.

Organization of this subsection

(1) Coding example

strFileName = "C:'\Sample.txt";
strCharValue = "\r\n";               // Deletes CR and LF.
if (AIT_FileOpen(strFileName, GENERIC_READ, OPEN_EXISTING, nFileHandle))
  // Reads data from the file.
  if (!AIT_FileGetLine(nFileHandle, strReadData))
    AIT_LogMessage("AIT_FileGetLine failed");
  else
    // Deletes CR and LF from the data read from the file.
    strStrName = AIT_StrRTrim(strReadData, strCharValue);
    AIT_LogMessage("strStrName = " + strStrName);
  endif;
  AIT_FileClose(nFileHandle);
else
  AIT_LogMessage("AIT_FileOpen failed");
endif;

(2) Results

The following shows the results output to RecDFile.log.

strStrName = Deleted CR and LF.