#include "stdafx.h" #include <iostream> #include <fstream> #include <string> #include <windows.h> using namespace std; int main () { string line; ifstream myfile ("1.txt"); getline (myfile,line); HGLOBAL hText; char *pText; hText = GlobalAlloc(GMEM_DDESHARE|GMEM_MOVEABLE, 100); pText = (char*)GlobalLock(hText); char *linec; linec = &line[0]; strcpy(pText, linec); GlobalUnlock(hText); OpenClipboard(NULL); EmptyClipboard(); SetClipboardData(CF_TEXT, hText); CloseClipboard(); myfile.close(); return 0; } strcpy (char *, char *), si tu ai pus string. Am creat un pointer de tip char pe care l-am setat pe adresa primul caracter.