365
Listing 18-3. The main routine of the Hello World program with replication
37
#include
38
#include
39
#include
40
#include
41
#include
42
#include
43
44
#include
45
46
/*
47
* English and Spanish translation of the message
48
*/
49
enum lang_t {en, es};
50
static const char *hello_str[] = {
51
[en] = "Hello world!",
52
[es] = "¡Hola Mundo!"
53
};
54
55
/*
56
* structure to store the current message
57
*/
58
#define STR_SIZE
100
59
struct hello_t {
60
enum lang_t lang;
61
char str[STR_SIZE];
62
};
63
64
/*
65
* write_hello_str -- write a message to the local memory
66
*/
Chapter 18 remote persistent memory
Précédent

- 388/457

Suivant