MTSkull
Well-known member
I am creating an application that will interface with an old service. I need to put a single line code into a text file to get it to do stuff elsewhere on the network. One of the requirements is the code must be a single line with no new line or whitespace beginning or end. Here is the code I am attempting to use. When I write the single line to the file and then read the file it shows as 4boxes (unrecognized char code?).
Thanks
MTS
Thanks
MTS
Code:
//c#
public Int32 IssueSerialNumber()
{ //Writes to a file monitored by a server service. When the service detects the appropriate code
Int32 PassFail = LocalError.ERROR_GEN_PASS;
StreamReader LFRead = new StreamReader("C:\\Lock001.txt");
string sTemp = LFRead.ReadLine();
if (sTemp != "RU")
{
//TODO the file is not ready, handle it
//return LocalError.ERROR_FILE_Something_New_Happened;
}
LFRead.Close();
StreamWriter LFWrite = new StreamWriter("C:\\Lock001.txt");
LFWrite.Write("S001_D1T");
LFWrite.Close();
return PassFail;
}