string handling [Scanned]
Arifa Khan
arifa.khan at ultratone.co.uk
Tue Jan 4 10:25:08 UTC 2011
Hi,
I'm trying to do some string manipulation, however I don't seem to be getting the response I expect.
To compare individual characters in one string to another, as follows:
int lettercode(char letter[], unsigned long dest)
{
int len;
char compare[27];
strcpy(compare, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
len = strlen(letter);
uart_send_num(len);
uart_send_num(letter[0]); // the result of this comes up as "00/"
if(!(strcmp(&letter[0],'H'))) // I've even tried if(!(strcmp(letter[0],'H'))) and if(!(strcmp(letter[0],"H"))) and if(!(strcmp(letter[0],compare[7)))
{
uart_send('k');
}
...
int main(...)
{
...
char sentence[256];
char compare[27];
int sentence_len;
strcpy(sentence, "HELLO");
strcpy(compare, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
sentence_len = strlen(sentence);
lettercode(sentence,0x31000000);
...
}
Any advice?
Thanks!
Arifa Khan
Embedded Engineer
T +44 (0)1233 625252
F +44 (0)1233 645897
arifa.khan at ultratone.co.uk
[cid:personal272ae.jpg]
Ultratone Scientific Instruments Ltd., Kingsnorth Technology Park, Wotton Road, Ashford, Kent, TN23 6LN.
Company registration number 01321345
IMPORTANT NOTICE.
Confidentiality: This e-mail and its attachments are intended for the above named only and may be confidential. If they have come to you in error you must take no action based on them, nor must you copy or show them to anyone; please reply to this e-mail and highlight the error.
Security Warning: Please note that this e-mail has been created in the knowledge that Internet e-mail is not a 100% secure communications medium.We advise that you understand and observe this lack of security when e-mailing us.
Viruses: Although we have taken steps to ensure that this e-mail and attachments are free from any virus, we advise that in keeping with good computing practice the recipient should ensure they are actually virus free.
Monitoring and Scanning: We have monitoring and scanning systems in place in relation to emails sent and received to: monitor / record business communications; prevent and detect crime; investigate the use of the Company's internal and external email system; and provide evidence of compliance with business practices.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sourcerytools.com/pipermail/c++-pthreads/attachments/20110104/98eaa4b1/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: personal272ae.jpg
Type: image/jpeg
Size: 22778 bytes
Desc: personal272ae.jpg
URL: <http://sourcerytools.com/pipermail/c++-pthreads/attachments/20110104/98eaa4b1/attachment.jpg>
More information about the c++-pthreads
mailing list