GetComputerName
- Posted at 2009/02/17 11:50
- Filed under 프로그래밍
Syntax
BOOL WINAPI GetComputerName(
__out LPTSTR lpBuffer,
__inout LPDWORD lpnSize
);
Parameters
- lpBuffer [out]
-
A pointer to a buffer that receives the computer name or the cluster virtual server name. The buffer size should be large enough to contain MAX_COMPUTERNAME_LENGTH + 1 characters.
- lpnSize [in, out]
-
On input, specifies the size of the buffer, in TCHARs. On output, the number of TCHARs copied to the destination buffer, not including the terminating null character.
- 영어라고 대충 읽었더니만~ 아니 그냥 한글이어도 대충 읽었을 간단한 함수인데..
- 잘나왔다가 안나왔다가 지맘대로 동작을 해서 이상하다 싶었는데..
- 두번째 인자가 __inout이었다. 버퍼가 할당된 크기를 알려주어야 하는데 변수를 초기화를 안했더니 0으로 되서 안나오는 경우도 있고 쓰레기 값들어가서 나올때도 있고 그랬던 거였다.
이런 세세한 것까지 죄다 기억할 수도 없는 노릇이고, 이거야 달랑 이름가져오는 문제여서 심각하지 않지만 중요한 부분에 이런 실수가 들어가있으면 정말 찾기도 어려울텐데~
갑자기 막 코딩을 하는 내 자신이 두려워지기 시작한다.
Posted by philosup
- Tag
- 코딩
- Response
- No Trackback , 2 Comments

