Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

strncmp(9r) [osf1 man page]

strncmp(9r)															       strncmp(9r)

NAME
strncmp - General: Compares two strings, using a specified number of characters SYNOPSIS
int strncmp( char *s1, char *s2, int n ); ARGUMENTS
Specifies a pointer to a string (an array of characters terminated by a null character). Specifies a pointer to a string (an array of characters terminated by a null character). Specifies the number of bytes to be compared. DESCRIPTION
The strncmp routine compares string s1 to string s2, using the number of characters specified in n. RETURN VALUES
If string s1 is equal to the null character ( ' ' ), strncmp returns the value 0 (zero). Otherwise, it returns the difference between the number of characters in s1 and s2. SEE ALSO
Routines: strcmp(9r) strncmp(9r)

Check Out this Related Man Page

STRCMP(3)						   BSD Library Functions Manual 						 STRCMP(3)

NAME
strcmp, strncmp -- compare strings LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <string.h> int strcmp(const char *s1, const char *s2); int strncmp(const char *s1, const char *s2, size_t n); DESCRIPTION
The strcmp() and strncmp() functions lexicographically compare the null-terminated strings s1 and s2. The strncmp() function compares not more than n characters. Because strncmp() is designed for comparing strings rather than binary data, characters that appear after a '' character are not compared. RETURN VALUES
The strcmp() and strncmp() functions return an integer greater than, equal to, or less than 0, according as the string s1 is greater than, equal to, or less than the string s2. The comparison is done using unsigned characters, so that '200' is greater than ''. SEE ALSO
bcmp(3), memcmp(3), strcasecmp(3), strcoll(3), strxfrm(3), wcscmp(3) STANDARDS
The strcmp() and strncmp() functions conform to ISO/IEC 9899:1990 (``ISO C90''). BSD
October 11, 2001 BSD
Man Page

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Carreer:Networking Programming in Unix (C programming Language)

Hello, I am trying to learn Networking Programming in C in unix enviorment. I want to know how good it is to become a network programmer. i am crazy about Network programming but i also want to opt for the best carreer options. Anybody experienced Network Programmer, please tell me is my... (5 Replies)
Discussion started by: vibhory2j
5 Replies

2. Programming

Print specific pattern line in c++

Input file: @HWI-BRUNOP1_header_1 GACCAATAAGTGATGATTGAATCGCGAGTGCTCGGCAGATTGCGATAAAC +HWI-BRUNOP1_header_1 TNTTJTTTETceJSP__VRJea`_NfcefbWe Desired output file: >HWI-BRUNOP1_header_1 GACCAATAAGTGATGATTGAATCGCGAGTGCTCGGCAGATTGCGATAAAC >HWI-BRUNOP1_header_2... (10 Replies)
Discussion started by: cpp_beginner
10 Replies

3. Programming

search a file between two begin and end strings in c

Can any one help me out with following problem... I want to search in a file which has two strings repeat each time(like start and end) i want to search between these two string in C programming. please help me with the solution. thanks in advance. (8 Replies)
Discussion started by: uday.sena.m
8 Replies

4. Programming

warning: comparison between pointer and integer

Hi guys :D I am still playing with my C handbook and yes, as you can see I have small problem as always :cool: I wrote a C code #include <stdio.h> #define MESSAGE 100 int main(void) { char input_mes - Pastebin.com And when I try to compile it I get following errors from gcc ... (1 Reply)
Discussion started by: solaris_user
1 Replies

5. Programming

search file and put into struct

hi everybody, I need some help with some programming. I need to write a file that can search in a text file and read the whole line into a struct. the struct = struct Transistor { char chType; char chFabrikant; float fPrijs; enum Transistor_Behuizing { empty,TO18, TO39,... (8 Replies)
Discussion started by: metal005
8 Replies

6. 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

7. Programming

Merge two strings by overlapped region

Hello, I am trying to concatenate two strings by merging the overlapped region. E.g. Seq1=ACGTGCCC Seq2=CCCCCGTGTGTGT Seq_merged=ACGTGCCCCCGTGTGTGTFunction strcat(char *dest, char *src) appends the src string to the dest string, ignoring the overlapped parts (prefix of src and suffix of dest).... (30 Replies)
Discussion started by: yifangt
30 Replies

8. Programming

Need help with counting within parallelized block - OpenMP/C-Programming

Hello together, I have a question for you. Since a few weeks I am trying to programm a small bruteforce application in C on Ubuntu 14.04.1 using Code::Blocks with gcc-4.8.2. My programm is nothing special. It's just for practise, Without hashing or something like that. For me the focus is on... (11 Replies)
Discussion started by: DaveX
11 Replies

9. Programming

Number to bit vector

Is there a function to convert number (unsigned int for this example) to binary? I could not find a simple one thru google. While I was learning bloom filter with the example, I was wondering if anybody can help me to 1) display the real bits vector for the bloomfilter; 2) if dataset is very... (11 Replies)
Discussion started by: yifangt
11 Replies

10. Homework & Coursework Questions

C shell program

1. I've have to write a shell program that accepts Ctrl+T (in linux os in c language) and should print out the current time and date to the screen. I've written the following code but i've to type ^T individual rather than pressing ctrl+T(^T) to get the output. : 2. How do i make the shell... (2 Replies)
Discussion started by: zorro_phu
2 Replies