[c++] 파일 여러개를 읽어서 clipboard에 넣을려고 하는데요...
글쓴이: rockmg / 작성시간: 토, 2009/10/10 - 4:43오후
안녕하세요~ C++ 초자 입니다
같은 프로그램을 C#에서는 금방 만들었는데...
C++(winapi만 이용해서) 만들려고 하는데..
string 부분에서 걸리네요 ㅠㅠ
LPSTR sss1 = "";
char buf[1024];
for(i=0; i<nItmeCount; i++)
{
ListView_GetItemText(hList,i,1,szFilePath,255);
hFile = CreateFile(szFilePath,GENERIC_READ,0,NULL, OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
if(hFile != INVALID_HANDLE_VALUE)
{
while(true)
{
lstrcat(sss1,buf);
bResult = ReadFile( hFile, buf, sizeof(buf), &dwRead, NULL );
if( ( TRUE == bResult ) && ( 0 == dwRead ) )
{
CloseHandle( hFile );
break;
}
}
}
}요런식으로 했는데.. sss1에 값이 안들어가네요.. 동적으로 sss1에 대해서 길이를 지정해줘야 하나요?? ㅠㅠ
Forums:


sss1에 메모리 할당을
sss1에 메모리 할당을 안하셨습니다. sss1는 char형 포인터일겁니다.
배열로 선언하시거나 적당히 동적할당 하여 쓰시면 될겁니다.
-------------------------------------------------------------------------------
It's better to appear stupid and ask question than to be silent and remain stupid.
-------------------------------------------------------------------------------
It's better to appear stupid and ask question than to be silent and remain stupid.
댓글 달기