Saving text to files from EDIT class

Miron the Master miron-the-master@usa.net
Wed Jan 28 15:02:00 GMT 1998


Hi, 
I've problem with saving text 
files.
Can you tell me what's wrong with this 
code:
 
hEdit - EDIT window  
 
int saveFile(char 
*filename) {     char buff[256];     int 
i;     int size;     int lines = 
SendMessage(hEdit, EM_GETLINECOUNT, 0, 0);     int fh = 
open(filename, O_WRONLY | O_CREAT);     for(i = 0; i < 
lines; i++)     
{         ((int *)buff)[0] = 
254;         size = SendMessage(hEdit, 
EM_GETLINE, i, (LPARAM)buff);         
buff[size] = 0x0d;      // 
CR         buff[size+1] = 
0x0a;    // LF         
write(fh, buff, size+1);     }     
close(fh);   
Thanx,
 
Daniel 
Mironowicz             
miron-the-master@usa.net



More information about the Cygwin mailing list