[En-Nut-Discussion] Need Help on Matrix prog_char

Ralph Mason ralph.mason at telogis.com
Tue Aug 3 07:24:06 CEST 2004


How about (not tested and likely to contain one or more bugs)

void gstring(FILE * stream,int line){
	PGM_P str = PSTR("Line1\0"
			 "Another Line\0"
			 "Yet a third\0"
                         "Forth line\0" );

	while(line--){
		while(PRG_RDB(str++));
	 }

	fputs_P(str,stream);
}

Cheers,
Ralph




>oI using Alot of string in my application.
>so i build a few String Loopup table
>that using
>
>void gstring(FILE * stream,int line)
>{
>static prog_char zman1[]="DeviceA[%d] %s <p>\n";
>static prog_char zman2[]="DeviceB[%d] %s <p>\n";
>     if (line==1)fprintf_P(stream,zman1);
>else if (line==2)fprintf_P(stream,zman2);
>
>}
>
>i planning to do it using matrix
>
>void gstring(FILE * stream,int line)
>{
>    static prog_char *zman[3];
>    zman[0]= "";
>    zman[1]= "DeviceA[%d] %s <p>\n";
>    zman[2]= "DeviceB[%d] %s <p>\n";
>    fprintf_P(stream,zman[1],);
>
>}
>
>But Matrix prog_char was not working. Anyway to build a string lookup table
>to save me some if else statement that waste rom space?
>
>since i use nearly 100 of if else statement on building my string lookup
>table.
>
>WF
>_______________________________________________
>En-Nut-Discussion mailing list
>En-Nut-Discussion at egnite.de
>http://www.egnite.de/mailman/listinfo.cgi/en-nut-discussion
>
>
>  
>




More information about the En-Nut-Discussion mailing list