notepad vs write

Dmitry Timoshkov dmitry at
Sun Jun 16 22:07:12 CDT 2002

"Francois Gouget" <fgouget at> wrote:

> The problem is that write will handle RTF and Word documents correctly,
> while notepad is just a text editor and will only display garbage...
> (yes, wordpad will probably have problems with complex word documents,
> but it should work with simple ones)

I believe that Write is able to handle only old Word 5.x/6.x format files
(and of course RTFs). RTFs should not produce too much trouble (just feed
them to a richedit control). Regarding Word 5.x format here is a snipped
from my very old DOS code which handled those files (*.doc,*.wri) well
(it completely ignores formatting though):

int is_word_doc(char *name, long *text_len)
    int fd;
    unsigned short head[64];

    if((fd = _open(name, O_BINARY | O_RDONLY)) == -1) return 0;

    _read(fd, head, sizeof(head));

    if(head[0] != 0137061 || head[2] != 0125400) return 0;

    *text_len = *(long *)(head + 7) - 128L;
    if(*text_len > 0) *text_len -= 1;

    return 1;

I.e. there is a 128 bytes header with signature and text length in it.

I think that our notepad could be easy enhanced to deal with that format.
Write could be just a symlink to notepad.


More information about the wine-devel mailing list