LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 11-28-2004, 12:25 AM   #1
foxele
LQ Newbie
 
Registered: Oct 2004
Location: san diego
Posts: 7

Rep: Reputation: 0
need some advices, which way is better


Hello:

I am writting a strIgnoreCaseCmp module which performs the same basic function as strncmp() but ignore case when comparing two strings.



The function prototype is int strIgnoreCaseCmp(const char *s1,
const char *s2,
unsigned int n)


for the compare part, I can just call strncmp(), but for the ignoring case part, I am not sure if I should use strlwr in string.h, or I have to use strlen combine with tolower to change the case of each character in the string.

I didn't use strlwr before, do you think it is a better way?


Thanks!


Alex
 
Old 11-28-2004, 01:24 AM   #2
vharishankar
Senior Member
 
Registered: Dec 2003
Posts: 3,142
Blog Entries: 4

Rep: Reputation: 121Reputation: 121
There is already a built in function for comparing cases insensitve. Just check up the

strcasecmp
strncasecmp

function in the man page. Both declared in strings.h

Last edited by vharishankar; 11-28-2004 at 01:25 AM.
 
Old 11-28-2004, 04:30 PM   #3
foxele
LQ Newbie
 
Registered: Oct 2004
Location: san diego
Posts: 7

Original Poster
Rep: Reputation: 0
sorry I didn't tell you, I am not allowed to use it.
 
Old 11-29-2004, 12:36 AM   #4
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris10, Solaris 11, Mint, OL
Posts: 9,481

Rep: Reputation: 354Reputation: 354Reputation: 354Reputation: 354
Sorry, I'm not allowed to provide an answer to you ....
 
Old 11-29-2004, 12:42 AM   #5
vharishankar
Senior Member
 
Registered: Dec 2003
Posts: 3,142
Blog Entries: 4

Rep: Reputation: 121Reputation: 121
Quote:
Originally posted by foxele
sorry I didn't tell you, I am not allowed to use it.
Sound very much like your homework problem.
Did you read the rules: http://www.linuxquestions.org/rules.php
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
new computer advices kvasarnomad Linux - Hardware 3 05-16-2005 02:52 AM
my first job as an admin - need advices ddaas Red Hat 1 12-21-2004 11:22 AM
advices on updating slack Nadim Slackware 1 04-16-2004 06:22 PM
Installation advices on mandrake 9.2 mindatwork Linux - Newbie 13 12-12-2003 03:22 PM
User account and SSH: I need advices... Zingaro2002 Linux - Security 8 10-31-2003 04:50 AM


All times are GMT -5. The time now is 04:55 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration