Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

strchr(3) [netbsd man page]

STRCHR(3)						   BSD Library Functions Manual 						 STRCHR(3)

NAME
strchr -- locate character in string LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <string.h> char * strchr(const char *s, int c); DESCRIPTION
The strchr() function locates the first occurrence of c in the string pointed to by s. The terminating NUL character is considered part of the string. If c is '', strchr() locates the terminating ''. RETURN VALUES
The function strchr() returns a pointer to the located character, or NULL if the character does not appear in the string. EXAMPLES
After the following call to strchr(), p will point to the string "oobar": char *p; char *s = "foobar"; p = strchr(s, 'o'); SEE ALSO
index(3), memchr(3), rindex(3), strcspn(3), strpbrk(3), strrchr(3), strsep(3), strspn(3), strstr(3), strtok(3) STANDARDS
The strchr() function conforms to ANSI X3.159-1989 (``ANSI C89''). BSD
August 11, 2002 BSD

Check Out this Related Man Page

STRCHR(3)						   BSD Library Functions Manual 						 STRCHR(3)

NAME
strchr, strrchr -- locate character in string LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <string.h> char * strchr(const char *s, int c); char * strrchr(const char *s, int c); DESCRIPTION
The strchr() function locates the first occurrence of c (converted to a char) in the string pointed to by s. The terminating null character is considered to be part of the string; therefore if c is '', the functions locate the terminating ''. The strrchr() function is identical to strchr(), except it locates the last occurrence of c. RETURN VALUES
The functions strchr() and strrchr() return a pointer to the located character, or NULL if the character does not appear in the string. SEE ALSO
memchr(3), memmem(3), strcspn(3), strpbrk(3), strsep(3), strspn(3), strstr(3), strtok(3), wcschr(3) STANDARDS
The functions strchr() and strrchr() conform to ISO/IEC 9899:1990 (``ISO C90''). BSD
April 19, 1994 BSD
Man Page

12 More Discussions You Might Find Interesting

1. Programming

error: invalid conversion from ‘const char*’ to ‘char*’

Compiling xpp (The X Printing Panel) on SL6 (RHEL6 essentially): xpp.cxx: In constructor ‘printFiles::printFiles(int, char**, int&)’: xpp.cxx:200: error: invalid conversion from ‘const char*’ to ‘char*’ The same error with all c++ constructors - gcc 4.4.4. If anyone can throw any light on... (8 Replies)
Discussion started by: GSO
8 Replies

2. Shell Programming and Scripting

How to fix line breaks format text for huge files?

Hi, I need to correct line breaks for huge files (more than 1MM records in a file) and then format it properly. Except the header and trailer, each record starts with 'D'. Requirement:Scan the whole file except the header and trailer records and see if any of the records start with... (19 Replies)
Discussion started by: kikionline
19 Replies

3. Programming

Changing the way arguments are read from program

I have the following piece of code. Currently the command line arguments are passed as shown below using the "= "sign. I capture the name of the argument, for example vmod and it's corresponding user parameter which is jcdint-z30.cmd. ./raytrac vmod=jcdint-z30.cmd srFile=jcdint.sr Now I want... (12 Replies)
Discussion started by: kristinu
12 Replies

4. Programming

C first Script Question

Gents for 2013 I have embarked on learning C and just wrote my first script and need some help. In the learning process, I am trying to understand where I went wrong with my script. The flow of the script is as such: Enter a number --> check if it is a number --> if it is not a number,print what... (4 Replies)
Discussion started by: metallica1973
4 Replies

5. UNIX for Dummies Questions & Answers

I am not able to use variables in system command in a C program

this method is not working.I am having a problem to use variables in system command. i cannot use the variables in system command. this how i was did system("whereis command"); this method works very fine. but, i want use the commands as variable. that means i want only pass the variables.... (6 Replies)
Discussion started by: dhanda2601
6 Replies

6. Shell Programming and Scripting

How to use SU inside script?

hi guys, I new to unix im generating a script within c code. I need to upgrade the software to a newer version and in need su privilege. what is the correct syntax in running su within the script? i would greatly appreciate your help many thanks rafael /* Y o u r D e s c r i p t i o... (2 Replies)
Discussion started by: rafae11
2 Replies

7. Programming

C++ getline, parse and take first tokens by condition

Hello, Trying to parse a file (in FASTA format) and reformat it. 1) Each record starts with ">" and followed by words separated by space, but they are in one same line for sure; 2) Sequences are following that may be in multiple rows with possible spaces inside until the next ">".... (18 Replies)
Discussion started by: yifangt
18 Replies

8. Programming

Wildcard Pattern Matching In C

I've been having problems lately trying to do pattern matching in C while implementing wildcards. Take for instance the following code: #include <sys/types.h> #include <sys/stat.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <dirent.h> #include <string.h> ... (14 Replies)
Discussion started by: Azrael
14 Replies

9. Shell Programming and Scripting

PHP parametric + bash script combination

Hello, I have a simple bash script and I manually run this script to put a file into related directory in apache normally. I need to run it in php with parameter. My target is to get a download link by running below script but I do not know anything about php. Here is my bash script: run.sh... (6 Replies)
Discussion started by: baris35
6 Replies

10. Programming

Segmentation fault when I pass a char pointer to a function in C.

I am passing a char* to the function "reverse" and when I execute it with gdb I get: Program received signal SIGSEGV, Segmentation fault. 0x000000000040083b in reverse (s=0x400b2b "hello") at pointersExample.c:72 72 *q = *p; Attached is the source code. I do not understand why... (9 Replies)
Discussion started by: jose_spain
9 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

12. Programming

Format specifier for sscanf() in C

Hello, I have formatted lines delimited by colon ":", and I need to parse the line into two parts with sscanf() with format specifiers. infile.txt: Sample Name: sample1 SNPs : 91 MNPs : 1 Insertions : 5 Deletions ... (13 Replies)
Discussion started by: yifangt
13 Replies