234 Part III
16 volatile int factor2 = 34;
17
18 // We know that 1863 multiples delay
19 // the proper amount
20 for (i = 0; i < 1863; ++i)
21 {
22 result = factor1 * factor2;
23 }
24 }
It’s things like this that make embedded programming so simple.
Answer 40: The problem is that
ostream
is passed as “pass by value”. You can’t
copy stream variables. (If you did it would mean that the system would
have to make a copy of the file.) The parameter should be changed to a
“pass by reference” parameter:
void print_msg_one(
// File to write the message to
class ostream &out_file,
// Where to send it
const char msg[]
)
Answer 41: The problem is the statement:
strcat(file_name, '/');
The
strcat
function takes two strings as arguments. In this example, we’ve
given it a ...