C#/Console(12)
-
[Console] 숫자만 입력받기
public int isNum(string a_str) { int rc = 0; //rc = 0 :문자, 1:정수, 2:실수 for (int i = 0; i = '0' && a_str[i] = 0) rc = 2; return rc; }
2011.09.21 -
[Console] DllImport
DllImport 특성을 이용하면 C# 에서 WinAPI 를 다룰수가 있다. 역시나 예제가 있어야 겠다. // Dll_import.cs using System; using System.Runtime.InteropServices; class MainApp { [ DllImport("user32.dll") ] public static extern int SendMessage(int hWnd, uint Msg, long wParam, long lParam); public const int WM_CLOSE = 0x0010; //닫기 public static void Main() { Console.WriteLine("user32.dll 의 SendMessage 함수를 쓰겠다."); SendMessage(0x000..
2011.09.14 -
[Console 08.23] 완벽한 코드
// // Copyright (c) LuciferD Company. All rights reserved. // // LuciferD namespace HelloWorld { using System; /// /// Main class. /// internal class Program { /// /// Main entry point. /// public static void Main() { Console.WriteLine("Hello, world"); } } } 이게 진정 완벽한 코드다~~!!
2011.08.23 -
[Console] C# 문자 변환
1. String -> Hex 1.private int ChangeStringToHex(String source) 2.{ 3.return int.Parse(source, System.Globalization.NumberStyles.HexNumber); 4.} 2. Hex -> String 1.private String ChangeHexToString(int number) 2.{ 3.return Convert.ToString(number, 16).ToUpper().PadLeft(2, '0'); 4.} 3. Byte[] -> UInt32 1.private UInt32 ChangeByteToUInt32(byte[] src, int i) 2.{ 3.return src[i] + (src[i + 1] > 8); 0..
2011.08.04 -
[Console]using 사용법
일반적인 사용법 Font font=new Font("arral",10.0f) if(font!=null) {((IDisposable)font).dispose();} using(Font font=new Font("arral",10.0f)) { //작업 } IDisposable 요게 되는게 using도 사용할 수 있어요^^ 아직 그렇게 대규모 프로젝트를 안해봐서 있으나 없으나 잘모르겠네요!!
2011.06.10 -
[Console 04.15] 01.데이터 파일 저장
FileStream fs=new FileStream(@"d:\test.txt",FileMode.Append,FileAccess.Write); StreamWriter sw = new StreamWriter(fs, System.Text.Encoding.UTF8); sw.Write(textBox1.Text); sw.Flush(); sw.Close(); fs.Close(); 같이 하면 된다..!! 가끔 필요할때 써야지!!
2011.04.15