On Nov 8, 2010, at 23:00:18, Ryan Govostes wrote:
>> 1. Use strlen instead of sizeof.
> 
> No, this would not work since there are null bytes.

Good catch. Strike #1.

>> 2. Declare an enum symbol for the desired number of characters, and use each 
>> symbol both to declare the length of the corresponding array and to replace 
>> the sizeof expressions.
> 
> Would this suffice?
> 
>> const char subn[] = "subn\x00\x00\x00\x01";
> 
> -->
> 
>> const char subn[] = { 's', 'u', 'b', 'n', '\x00', '\x00', '\x00', '\x01'};

Yup. Let's call that solution #3.


Reply via email to