Search Results

Search: Posts Made By: powyama
Forum: Programming 12-10-2012
1,919
Posted By Don Cragun
No! You can't use an uninitialized value to...
No! You can't use an uninitialized value to specify the number of bytes to write. You shouldn't use functions without providing their function prototypes. You shouldn't use cat to write binary...
Forum: Programming 10-22-2012
3,273
Posted By expl
strcpy(wwn1,"\x50\x00\x53\x30\x08\x09\x82\x32"); ...
strcpy(wwn1,"\x50\x00\x53\x30\x08\x09\x82\x32");

strcpy() will copy until 0 terminated char is reached and you have 0 char in second position so it will copy only first byte and leave the rest the...
Forum: Programming 10-18-2012
3,273
Posted By expl
(i) you are assigning simple ASCII string here...
(i) you are assigning simple ASCII string here that is literally "0x5000533008098217". But since you are defining 'pwwn' to be 8 byte long the string will be striped by compiler to first 8 characters...
Forum: Programming 10-18-2012
3,273
Posted By expl
Using general array assignment unsigned char...
Using general array assignment

unsigned char wwn[8] = {0x50, 0x00, 0x53, 0x30, 0x08, 0x09, 0x82, 0x17};


OR

Using string literal syntax

unsigned char wwn[8] =...
Forum: Programming 10-18-2012
3,273
Posted By JohnGraham
When a number starts with a leading "0", it's...
When a number starts with a leading "0", it's interpreted as an octal number, which can only use digits 0-7 (inclusive). Fix this, recompile and see what the output is.

Also, do you know that...
Forum: Programming 10-16-2012
2,183
Posted By JohnGraham
They could - it's just a matter of style. Using...
They could - it's just a matter of style. Using '(1 << 3)' makes it explicitly clear that what you're dealing with a bit. They both mean the same thing to the compiler, it's just what they signal to...
Forum: Programming 10-16-2012
2,183
Posted By hergp
I think it's mostly semantics. If you use the...
I think it's mostly semantics. If you use the shift operator, you emphasise on a certain bit pattern at a specific bit offset in a variable. In Don Cragun's example, the emphasis is on the the fact,...
Forum: Programming 10-16-2012
2,183
Posted By Don Cragun
There is certainly no reason to #define TI_ZN to...
There is certainly no reason to #define TI_ZN to two different values (unless there are conditional tests to choose one setting over another based on the compilation environment) unless you're trying...
2,090
Posted By itkamaraj
The address of a block returned by malloc or...
The address of a block returned by malloc or realloc in the GNU system is always a multiple of eight (or sixteen on 64-bit systems). If you need a block whose address is a multiple of a higher power...
Forum: Programming 03-30-2011
2,487
Posted By Corona688
NUM is not a variable. #define's do literal text...
NUM is not a variable. #define's do literal text substition at compile-time, which ends up trying to do send_items(items, item_name_length, &8 , &new_socket_fd);, which of course won't work.
Showing results 1 to 10 of 10

 
All times are GMT -4. The time now is 07:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy