1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
void CTatoSelectNDlg::Onselect()
{
// TODO: Add your control notification handler code here
UpdateData();
int Larg = GetDlgItemInt(IDC_EDIT1);
int Haut= GetDlgItemInt(IDC_EDIT2);
int Init = GetDlgItemInt(IDC_EDIT3);
int Selectn = GetDlgItemInt(IDC_EDIT4);
srand( (unsigned )Init );
// Traitement différent selon nombre de bits/pixel
int x,y,x1,y1;
FILE *f;
//HANDLE k = CreateFile (" c:\\tatouage\\patchwork\\text.txt", GENERIC_WRITE, FILE_SHARE_WRITE, NULL,FILE_ATTRIBUTE_ARCHIVE,FILE_FLAG_WRITE_THROUGH ,SECURITY_ANONYMOUS);
HANDLE hFile = CreateFile(TEXT("c:\\tatouage\\patchwork\\test.txt"),GENERIC_READ|GENERIC_WRITE,FILE_SHARE_WRITE,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL|FILE_FLAG_OVERLAPPED,NULL);
//j'ai pas compris une chose , quel est le role du hFile??
//par exemple je met f=fopen("hFile","w") ; le fichier cett fois çi sera cree ds "C:\\tatouage"!!!
//avec une format inconne donc moi je choisit de l'ouvrir par bloc note
f=fopen("c:\\tatouage\\patchwork\\test.txt","w" );
for (int i=0; i<Selectn; i++)
{
x= (rand()/(double)RAND_MAX)* Larg;
y= (rand()/(double)RAND_MAX)* Haut;
x1= (rand()/(double)RAND_MAX)* Larg;
y1= (rand()/(double)RAND_MAX)* Haut;
fprintf(f,"(%d,%d)-(%d,%d) \n",x,y,x1,y1);
fclose;
}
} |
Partager