我有以下代码使用 ftp 下载 txt 文件并写回另一个文件。
ftp = (FtpWebRequest)WebRequest.Create("ftp://" + ftpHost + ftpDIR + "/SAPValidObjects.txt");
ftp.Method = WebRequestMethods.Ftp.DownloadFile;
ftp.UseBinary = false;
ftp.Credentials = new NetworkCredential(ftpUserID, ftpPWD);
FtpWebResponse response = (FtpWebResponse)ftp.GetResponse();
Stream sResponse = response.GetResponseStream();
StreamReader srSAPCostObjects = new StreamReader(sResponse);
m_swSAPCostCentres.Write(srSAPCostObjects.ReadToEnd());
m_swSAPCostCentres.Close();
response.Close();
m_swSAPCostCentres = new StreamWriter(Properties.Settings.Default.SAPInt + @"\SAPCostCentres" + ".txt");
出于某种原因,它会在
m_swSAPCostCentres.Write(srSAPCostObjects.ReadToEnd());
不知道为什么,请有人指导我。