假設兩臺計算機的窗口,您可以共享該文件和訪問它使用書寫的文件夾:
using (StreamWriter writer = new StreamWriter(@"\\IPADDRESS\directories\file.txt")
{
writer.Write("Word ");
}
和使用閱讀:
File.ReadAllLines(@"\\IPADDRESS\directories\file.txt");
與其他文件讀取器/寫入器相同。
與涉及Android操作系統的文件上,而FTP列入額外的信息,我只能說,
將對您有用。
我會粘貼來自CodeProject article的相關信息。
這些代碼都不是我的,但它會做你想要的。
只要記住一旦完成,就將文件上傳回android系統。
/* Download File */
public void download(string remoteFile, string localFile)
{
try
{
/* Create an FTP Request */
ftpRequest = (FtpWebRequest)FtpWebRequest.Create(host + "/" + remoteFile);
/* Log in to the FTP Server with the User Name and Password Provided */
ftpRequest.Credentials = new NetworkCredential(user, pass);
/* When in doubt, use these options */
ftpRequest.UseBinary = true;
ftpRequest.UsePassive = true;
ftpRequest.KeepAlive = true;
/* Specify the Type of FTP Request */
ftpRequest.Method = WebRequestMethods.Ftp.DownloadFile;
/* Establish Return Communication with the FTP Server */
ftpResponse = (FtpWebResponse)ftpRequest.GetResponse();
/* Get the FTP Server's Response Stream */
ftpStream = ftpResponse.GetResponseStream();
/* Open a File Stream to Write the Downloaded File */
FileStream localFileStream = new FileStream(localFile, FileMode.Create);
/* Buffer for the Downloaded Data */
byte[] byteBuffer = new byte[bufferSize];
int bytesRead = ftpStream.Read(byteBuffer, 0, bufferSize);
/* Download the File by Writing the Buffered Data Until the Transfer is Complete */
try
{
while (bytesRead > 0)
{
localFileStream.Write(byteBuffer, 0, bytesRead);
bytesRead = ftpStream.Read(byteBuffer, 0, bufferSize);
}
}
catch (Exception ex) { Console.WriteLine(ex.ToString()); }
/* Resource Cleanup */
localFileStream.Close();
ftpStream.Close();
ftpResponse.Close();
ftpRequest = null;
}
catch (Exception ex) { Console.WriteLine(ex.ToString()); }
return;
}
您是否編寫了訪問本地文件的代碼?你有訪問網絡文件的特定問題嗎?你需要告訴我們你需要知道什麼。 – 2013-03-20 11:13:09
這沒有顯示任何類型的研究工作。 -1 – Otiel 2013-03-20 11:14:02
您可以在兩臺機器之間建立SMB連接嗎?你能夠創建一個應用程序來編輯本地文件嗎?如果2x是:使用相同的技術來遠程編輯文件。 – Simon 2013-03-20 11:20:37