상세 컨텐츠

본문 제목

C# - 디렉토리 및 파일 생성

컴퓨터 언어/C#

by cepiloth 2015. 8. 2. 12:08

본문

728x90
반응형

2012-03-12 : 초안 작성

2017-12-30 : 소스 코드 수정 및 추가


using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace createdir
{
private DirectoryInfo dir;
private StreamWriter sr;
/*
* @brief : create file path
* @path : filepath
*/
private void create(string path)
{
dir = Directory.CreateDirectory(path);
if (Directory.Exists(month)) {
// thread-safe
lock (this)
{
this.sr = new StreamWriter(path + ".log", true);
this.sr.Write(System.DateTime.Now.ToString("HH:mm:ss"));
this.sr.Flush();
}
}
}
}
view raw dir.cs hosted with ❤ by GitHub


728x90
반응형

관련글 더보기

댓글 영역