avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] pointer to program memory string


From: Leo Hendrawan
Subject: [avr-gcc-list] pointer to program memory string
Date: Wed, 24 Nov 2004 15:39:36 +0000 (GMT)

Hello all,

suppose i have a struct which is:

        struct a {
                char*data;      // data to be sent
                unsigned int datalen;
                char*datasrc;   // data source
        };

and i have some program memory strings:

        char b[] PROGMEM = {"........"};
        char c[] PROGMEM = {"............."};

then could point the datasrc above to these program memory strings like
this:

        a->data = &buffer[0];   // point to the data buffer to be sent

        a->datasrc = &b[0]; (or) a->datasrc = &c[0];

        a->datalen = strlen_P(datasrc);

        for(i=0 ; i<(a->datalen-1) ; i++)
        {
                a->data[i]=PRG_RDB(a->datasrc[i]);
        }

i have tried this once but it doesn't work.
any suggestion?

Best regards,

--------------------------
 Leo Hendrawan
 13200005
 at 15:31 Nov 24
--------------------------




reply via email to

[Prev in Thread] Current Thread [Next in Thread]