Skip to Content
Cクイックリファレンス 第2版
book

Cクイックリファレンス 第2版

by Peter Prinz, Tony Crawford, 黒川 利明, 島 敏博
November 2016
Beginner to intermediate
816 pages
19h 58m
Japanese
O'Reilly Japan, Inc.
Content preview from Cクイックリファレンス 第2版
17.5
 マルチバイト文字
319
17.4
 文字列処理
文字列は、文字列終端文字
'\0'
で終わる一連の文字の列である。文字列の長さは、文字
列終端子の前の文字の個数とする。文字列は、バイト文字からなるバイト文字列かワイド
文字からなるワイド文字列である。バイト文字列は
char
型の配列に格納され、ワイド文字
列はワイド文字型
wchar_t
,
char16_t
,
char32_t
のいずれかを要素とする配列に格納される。
Cは文字列の基本型を持たず、文字列の連結、比較、値代入などの演算子を持たない。
その代わりに、標準ライブラリが文字列にそれらおよびその他の演算を行う関数(表17-16
に示す)を提供する。ヘッダstring.hは通常の
char
文字列の関数を宣言する。それらの関
数名は
str
から始まる。ヘッダwchar.hはワイド文字列の対応する関数を
wcs
から始まる名
前で宣言する。
他の配列同様、式の中の文字列は先頭要素へのポ
インタに暗黙的に変換される。文字列
を関数への引数として渡すと、関数は先頭文字へのポインタだけ受け取り、文字列長を文
字列終端文字の位置によってのみ決定できる。
表17-16 文字列処理関数
目的        string.hの関数 wchar.hの関数
文字列の長さ
strlen()
,
strnlen_s() wcslen()
,
wcsnlen_s()
文字列をコピー
strcpy()
,
strncpy()
,
strcpy_s()
,
strncpy_s()
wcscpy()
,
wcsncpy() ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Rustの練習帳 ―コマンドラインツールの作成を通してRustを学ぶ

Rustの練習帳 ―コマンドラインツールの作成を通してRustを学ぶ

Ken Youens-Clark, 中山 光樹
Unityによるモバイルゲーム開発 ―作りながら学ぶ2D/3Dゲームプログラミング入門

Unityによるモバイルゲーム開発 ―作りながら学ぶ2D/3Dゲームプログラミング入門

Jon Manning, Paris Buttfield-Addison, 鈴木 久貴, あんどうやすし, 江川 崇, 安藤 幸央, 高橋 憲一

Publisher Resources

ISBN: 9784873117812Other