memmem

Section: C Library Functions (3)
Updated: 2026-02-08
Index JM Home Page roff page
 

名前

memmem - 部分文字列の位置を示す  

ライブラリ

標準 C ライブラリ (libc,~-lc)  

書式

#define _GNU_SOURCE         /* feature_test_macros(7) 参照 */
#include <string.h>

void *memmem(size_t hsize, size_t nsize;
             const void haystack[hsize], size_t hsize,
             const void needle[nsize], size_t nsize);
 

説明

The memmem() function finds the start of the first occurrence of the substring needle of size nsize in the memory area haystack of size hsize.  

返り値

memmem() 関数は、部分文字列の開始を指すポインターを返し、もし部分文字列が 見つからない場合は NULL を返す。  

属性

この節で使用されている用語の説明については、 attributes(7) を参照。
インターフェース属性値
memmem() Thread safetyMT-Safe
 

標準規格

なし。  

歴史

musl libc 0.9.7; FreeBSD 6.0, OpenBSD 5.4, NetBSD, Illumos.  

バグ

glibc 2.0 では、 needle が空の場合、 memmem() は haystack の最後のバイトへのポインターを返す。 これは glibc 2.1 で修正されている。  

関連項目

bstring(3), strstr(3)


 

Index

名前
ライブラリ
書式
説明
返り値
属性
標準規格
歴史
バグ
関連項目

This document was created by man2html, using the manual pages.