tamadsijuan
Eternal Poster
- Joined
- Feb 17, 2016
- Posts
- 849
- Reaction
- 327
- Points
- 260
Need Help po gusto ko po kasi gumawa ng simpleng program na mag oopen ng text file and copy it to another text file
Question ko po kasi is panu iopen ung text file na hindi na kailangan ilagay yung mismong filename nya
Ito po ung code ko:
Website.txt - yan ung sample text file ko
WebsiteDownload.txt - output po auto create ng textfile
using System;
using System.IO;
namespace ReadText
{
class ReadText
{
static void Main(string[] args)
{
/*open text file (specific filename)
string text = System.IO.File.ReadAllText(@"D:\URL\website.txt");
Console.WriteLine (text);*/
// Copy content of text file (specific filename)
string data;
data = File.ReadAllText(@"D:\URL\Website.txt");
Console.WriteLine("Content of Website.txt :\n" + data);
File.Copy(@"D:\URL\Website.txt", @"D:\URL\WebsiteDownload.txt");
data = File.ReadAllText(@"D:\URL\WebsiteDownload.txt");
Console.WriteLine("Content of WebsiteDownload.txt :\n" + data);
}
}
}
Question ko po kasi is panu iopen ung text file na hindi na kailangan ilagay yung mismong filename nya
Ito po ung code ko:
Website.txt - yan ung sample text file ko
WebsiteDownload.txt - output po auto create ng textfile
using System;
using System.IO;
namespace ReadText
{
class ReadText
{
static void Main(string[] args)
{
/*open text file (specific filename)
string text = System.IO.File.ReadAllText(@"D:\URL\website.txt");
Console.WriteLine (text);*/
// Copy content of text file (specific filename)
string data;
data = File.ReadAllText(@"D:\URL\Website.txt");
Console.WriteLine("Content of Website.txt :\n" + data);
File.Copy(@"D:\URL\Website.txt", @"D:\URL\WebsiteDownload.txt");
data = File.ReadAllText(@"D:\URL\WebsiteDownload.txt");
Console.WriteLine("Content of WebsiteDownload.txt :\n" + data);
}
}
}