Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ReadWrite
- {
- class FileWriter
- {
- static void ReadWriteFile(string inFile, string outFile, string comparer)
- {
- string line;
- using (System.IO.StreamReader reader = new System.IO.StreamReader(inFile))
- using (System.IO.StreamWriter writer = new System.IO.StreamWriter(outFile))
- {
- while ((line = reader.ReadLine()) != null)
- {
- if (line.Contains(comparer))
- {
- writer.WriteLine(line);
- }
- }
- }
- }
- static void Main(string[] args)
- {
- string inFile = args[0];
- string outFile = args[1];
- string comparer = args[2];
- if (String.IsNullOrEmpty(inFile) || String.IsNullOrEmpty(outFile) || String.IsNullOrEmpty(comparer))
- throw new ArgumentException("Parametrii sunt incorecți");
- ReadWriteFile(inFile, outFile, comparer);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement