Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

strrchr(3) [linux man page]

STRCHR(3)						     Linux Programmer's Manual							 STRCHR(3)

NAME
strchr, strrchr, strchrnul - locate character in string SYNOPSIS
#include <string.h> char *strchr(const char *s, int c); char *strrchr(const char *s, int c); #define _GNU_SOURCE #include <string.h> char *strchrnul(const char *s, int c); DESCRIPTION
The strchr() function returns a pointer to the first occurrence of the character c in the string s. The strrchr() function returns a pointer to the last occurrence of the character c in the string s. The strchrnul() function is like strchr() except that if c is not found in s, then it returns a pointer to the null byte at the end of s, rather than NULL. Here "character" means "byte"; these functions do not work with wide or multibyte characters. RETURN VALUE
The strchr() and strrchr() functions return a pointer to the matched character or NULL if the character is not found. The strchrnul() function returns a pointer to the matched character, or a pointer to the null byte at the end of s (i.e., s+strlen(s)) if the character is not found. VERSIONS
strchrnul() first appeared in glibc in version 2.1.1. CONFORMING TO
strchr() and strrchr() are in SVr4, 4.3BSD, C89, C99. strchrnul() is a GNU extension. SEE ALSO
index(3), memchr(3), rindex(3), string(3), strlen(3), strpbrk(3), strsep(3), strspn(3), strstr(3), strtok(3), wcschr(3), wcsrchr(3), fea- ture_test_macros(7) COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. GNU
2010-09-20 STRCHR(3)

Check Out this Related Man Page

STRCHR(3)						     Linux Programmer's Manual							 STRCHR(3)

NAME
strchr, strrchr, strchrnul - locate character in string SYNOPSIS
#include <string.h> char *strchr(const char *s, int c); char *strrchr(const char *s, int c); #define _GNU_SOURCE /* See feature_test_macros(7) */ #include <string.h> char *strchrnul(const char *s, int c); DESCRIPTION
The strchr() function returns a pointer to the first occurrence of the character c in the string s. The strrchr() function returns a pointer to the last occurrence of the character c in the string s. The strchrnul() function is like strchr() except that if c is not found in s, then it returns a pointer to the null byte at the end of s, rather than NULL. Here "character" means "byte"; these functions do not work with wide or multibyte characters. RETURN VALUE
The strchr() and strrchr() functions return a pointer to the matched character or NULL if the character is not found. The terminating null byte is considered part of the string, so that if c is specified as '', these functions return a pointer to the terminator. The strchrnul() function returns a pointer to the matched character, or a pointer to the null byte at the end of s (i.e., s+strlen(s)) if the character is not found. VERSIONS
strchrnul() first appeared in glibc in version 2.1.1. CONFORMING TO
strchr() and strrchr() are in SVr4, 4.3BSD, C89, C99. strchrnul() is a GNU extension. SEE ALSO
index(3), memchr(3), rindex(3), string(3), strlen(3), strpbrk(3), strsep(3), strspn(3), strstr(3), strtok(3), wcschr(3), wcsrchr(3) COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. GNU
2012-04-24 STRCHR(3)
Man Page

11 More Discussions You Might Find Interesting

1. Programming

char constants vs. hard-coding

This might be a silly question, but I thought I'd ask anyway. If I'm writing in C, isn't it more efficient to, for instance, use constant character variable set to 'A' instead of hard-coding a character 'A'? Since it's only a single character instead of a string, it might not matter much. (10 Replies)
Discussion started by: cleopard
10 Replies

2. Solaris

Not able to lock the port

Hi, I am working with Sun-Solaris 9 and in our application I need to connect the UPS with Serial port,after that I need to monitor it..but before stating communication,It should lock that port,To check it,first i am trying to make sure the lock directory exists and I am able to find it(/var/lock)... (0 Replies)
Discussion started by: smartgupta
0 Replies

3. Programming

Socket Programming Send File

Hello my friends; Look at this 2 program: Client: #include <stdlib.h> #include <stdio.h> #include <string.h> #include <sys/socket.h> #include <sys/types.h> #include <netinet/in.h> #include <arpa/inet.h> int main ( int agrc, char *argv ) { int Socket; struct sockaddr_in... (5 Replies)
Discussion started by: htabesh
5 Replies

4. Shell Programming and Scripting

Matching 2 items in a string

Little lost here, I am trying to search a line for both values after the $ signs. My ultimate goal is to get percertage. <?php $string = "Something on sale for $4 and orginal price $10"; $strstr =. strstr($string, '$'); $strrchr =. strrchr($string, '$'); echo "$strstr<br>"; echo... (1 Reply)
Discussion started by: mrlayance
1 Replies

5. Programming

Redirecting Terminal to Local Application!

i wanted to execute some terminal commands on local linux, parse their output and display it to the user, i checked netcat source code but i couldnt understance it since im new to c (and linux at the same time). so i was wondering if there is away to run an instance of terminal hidden, read and... (15 Replies)
Discussion started by: JonhyM
15 Replies

6. Programming

C code : Segmentation fault

Hi Friends, I have written a small code in C which performs the below operations Task : 1 ) read line by line from a file. 2 ) assuming 3th and 4th fields of the file as GN and GNTO 3 ) The target file should contain all the fields except GNTO. 4... (3 Replies)
Discussion started by: kiran_bhatter
3 Replies

7. UNIX for Dummies Questions & Answers

Simple Problems to Solve!

Hi, I'm pretty poor at using UNIX but I'm learning. Please help me with these simple problems! Much appreciated! 1. I've changed my shell from bash to csh but I prefer bash. How do I change back? I've tried using chsh -s but it's not working! 2. I'm trying to download TopCat. I've done... (2 Replies)
Discussion started by: SimonWhite
2 Replies

8. Programming

Using boost in program created by g++

I am trying to use the split provided by boost. I have a string and want to split on "/". string value = "trig/4"; Have no idea how to compile and link it. I have extracted boost in /chrisd/tomso-12.04/source/library/boost_1_52_0 In my program /raytrac.cc I have put ... (5 Replies)
Discussion started by: kristinu
5 Replies

9. UNIX for Advanced & Expert Users

Memory fragmentation in a Linux settop box

Being a moderator at openATV, a forum for Linux settup boxes, I have seen reports, and sometimes am experiencing myself, artefacts during video playback or timeshift. As the artefacts are non repetetive (rewinding and watching again does not show artefacts), I can exclude a corrupted video source.... (23 Replies)
Discussion started by: Fischreiher
23 Replies

10. Shell Programming and Scripting

Leaving directory Error

Hi, i have a question, when I install any software it give error message like as follow : sudo make password for csm: make all-recursive make: Entering directory `/home/csm/Desktop/miRanda-3.3a' Making all in man make: Entering directory `/home/csm/Desktop/miRanda-3.3a/man' make:... (18 Replies)
Discussion started by: harpreetmanku04
18 Replies

11. UNIX for Beginners Questions & Answers

NTP synchronised problem in our Centos 7.6 node

Someone, please help on this issue:- Note : for security reason i didn't mention hostnames and ips. ============================================================================== # ntpstat unsynchronised polling server every 1024 s Ntpstat showing unsynchronised. ... (29 Replies)
Discussion started by: shanmugaraj
29 Replies