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