LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   String manipulation in C (https://www.linuxquestions.org/questions/programming-9/string-manipulation-in-c-592045/)

xeon123 10-15-2007 04:24 PM

String manipulation in C
 
Hi,

I'm sorry, but I kind of a newbie in C.

In C, how do I check that a string starts with a specified string?

For example:
startsWith("ls", "ls -la");

Thanks,
Pedro

xeon123 10-15-2007 05:00 PM

I just found the solution.

I only had to use strncmp.

student04 10-17-2007 01:17 PM

Quote:

Originally Posted by pedrosacosta (Post 2925301)
Hi,

I'm sorry, but I kind of a newbie in C.

In C, how do I check that a string starts with a specified string?

For example:
startsWith("ls", "ls -la");

Thanks,
Pedro

Two sites that are of great help:

http://www.cppreference.com

http://www.cplusplus.com (Just use the search bar above and look through what it finds as relevant.)

Enjoy.

-AM


All times are GMT -5. The time now is 11:23 AM.