0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

paiza.ioでc# その16

Posted at

概要

paiza.ioでc#、やってみた。
練習問題やってみた。

習問題

HTMLをゲットせよ。

サンプルコード


using System;
using System.IO;
using System.Net;
using System.Text;

namespace App 
{
	class test {
		static void Wget(string url) {
			WebRequest req = WebRequest.Create(url);
			WebResponse res = req.GetResponse();
			Stream st = res.GetResponseStream();
			StreamReader sr = new StreamReader(st);
			string txt = sr.ReadToEnd();
			sr.Close();
			st.Close();
			string name = "index.html";
			StreamWriter sw = new StreamWriter(name, false);
			sw.Write(txt);
			sw.Close();
			Console.WriteLine(txt);
		}
		static void Main() {
			Wget("https://qiita.com");
		}
	}
}





成果物

以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?