1

コードはユーザー入力 (html タグ) を受け取ります

ex:
<p> The content is &nbsp; text only &nbsp; inside tag </p>

gets(str);

タスクは、すべての&nbsp;オカレンスをnewline("\n")

while((ptrch=strstr(str, "&nbsp;")!=NULL)
{
  memcpy(ptrch, "\n", 1);
}

printf("%s", str);

上記のコードは、最初の文字のみを\n.

ヌルポインタ('\0')で文字列を終端せずに全体を置換する方法や残りを空文字定数のようなものに設定する方法を問い合わせ&nbsp;ます\nnbsp;

4

3 に答える 3