Application Version
From Nutwiki
Test Environments
|
||||||||||
|
Description
This example shows an easy and common way to store a string (e.g. for the application version) and printing it out.
Source Code
<source lang="c">
- include <dev/board.h>
- include <stdio.h>
int main(void) {
char *version = "1.0";
u_long baud = 115200;
NutRegisterDevice(&DEV_DEBUG, 0, 0); freopen(DEV_DEBUG_NAME, "w", stdout); _ioctl(_fileno(stdout), UART_SETSPEED, &baud);
printf("Application version: %s\n", version);
for(;;); return 0;
}
</source>
Output
Application version: 1.0
Details
<source lang="c"> char *version = "1.0"; </source>
defines a pointer to the type char, which points to an adress in memory where the string "1.0" is stored.
<source lang="c"> printf("Application version: %s\n", version); </source>
now prints out the string stored at the adress, the version
pointer provides.Template:Languages