From: miron-the-master AT usa DOT net (Miron the Master) Subject: Saving text to files from EDIT class 28 Jan 1998 20:08:35 -0800 Message-ID: <01bd2c1c$0f2f33a0$LocalHost.cygnus.gnu-win32@ppp> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_017B_01BD2C24.70F39BA0" To: "GNU-Win32 Mailing list" This is a multi-part message in MIME format. ------=_NextPart_000_017B_01BD2C24.70F39BA0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable Hi,=20 I've problem with saving text files. Can you tell me what's wrong with this code: =20 hEdit - EDIT window=20 =20 int saveFile(char *filename) { char buff[256]; int i; int size; int lines =3D SendMessage(hEdit, EM_GETLINECOUNT, 0, 0); int fh =3D open(filename, O_WRONLY | O_CREAT); for(i =3D 0; i < lines; i++) { ((int *)buff)[0] =3D 254; size =3D SendMessage(hEdit, EM_GETLINE, i, (LPARAM)buff); buff[size] =3D 0x0d; // CR buff[size+1] =3D 0x0a; // LF write(fh, buff, size+1); } close(fh); =20 Thanx, Daniel Mironowicz miron-the-master AT usa DOT net ------=_NextPart_000_017B_01BD2C24.70F39BA0 Content-Type: text/html; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable
Hi,
I've problem with saving text=20 files.
Can you tell me what's wrong with = this=20 code:
 
hEdit - EDIT = window 
 
int saveFile(char=20 *filename)
{
    char = buff[256];
    int=20 i;
    int size;
    int lines =3D=20 SendMessage(hEdit, EM_GETLINECOUNT, 0, 0);
    int fh = =3D=20 open(filename, O_WRONLY | O_CREAT);
    for(i =3D 0; i = <=20 lines; i++)
   =20 {
        ((int *)buff)[0] =3D=20 254;
        size =3D = SendMessage(hEdit,=20 EM_GETLINE, i, = (LPARAM)buff);
       =20 buff[size] =3D 0x0d;      //=20 CR
        buff[size+1] =3D=20 0x0a;    // = LF
       =20 write(fh, buff, size+1);
    }
   =20 close(fh);
  
Thanx,
 
Daniel=20 Mironowicz          &nb= sp; =20 miron-the-master AT usa DOT net ------=_NextPart_000_017B_01BD2C24.70F39BA0-- - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".