QUOTE(ikanmasin @ Nov 11 2010, 07:59 PM)
hi all,
i am programming a chip using MPLAB HI-TECH, but stuck with the empty array.
well, the program started with i declare an array to store the password, if the array is empty then the key in password will set as password.. now my problem is how to write to know the array is empty?
partial of my programming
unsigned char keyin_char[4]; //declare an 4 values for receiving password
unsigned char stalled_char[4]; // declare an 4 values password array to store the password like this correct?
if(stalled_char[4]="NULL") // problem starts here, how to write IF array is empty then first keyin_char send to first stalled_char
{
password_count=0;
(keyin_char[0]=stalled_char[0]);
(keyin_char[1]=stalled_char[1]);
(keyin_char[2]=stalled_char[2]);
(keyin_char[3]=stalled_char[3]);
(keyin_char[4]=stalled_char[4]);
(keyin_char[5]=stalled_char[5]);
}
thanks all
First of all, stalled_char[4] represents a byte (character) in the stalled_char array. i am programming a chip using MPLAB HI-TECH, but stuck with the empty array.
well, the program started with i declare an array to store the password, if the array is empty then the key in password will set as password.. now my problem is how to write to know the array is empty?
partial of my programming
unsigned char keyin_char[4]; //declare an 4 values for receiving password
unsigned char stalled_char[4]; // declare an 4 values password array to store the password like this correct?
if(stalled_char[4]="NULL") // problem starts here, how to write IF array is empty then first keyin_char send to first stalled_char
{
password_count=0;
(keyin_char[0]=stalled_char[0]);
(keyin_char[1]=stalled_char[1]);
(keyin_char[2]=stalled_char[2]);
(keyin_char[3]=stalled_char[3]);
(keyin_char[4]=stalled_char[4]);
(keyin_char[5]=stalled_char[5]);
}
thanks all
Secondly, if memory serves me well, if you write out the value of stalled_char[4] if it's null, it should return 0 (as in the ASCII code), I may be wrong.
Have you tried to use strcmp function?
Nov 11 2010, 08:39 PM

Quote
0.1542sec
0.62
6 queries
GZIP Disabled