为什么C++的输入输出使用">>"和"<<"这两个符号?操作系统的重定向操作符就是使用">",">>",如以下的windows平台的批处理(bat)文件:
【C++|输入输出的插入、提取操作符与重定向、移位操作】chcp 65001echo ^<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" >more.htmlecho"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"^> >>more.htmlecho ^<html xmlns="http://www.w3.org/1999/xhtml"^> >>more.htmlecho ^<base target="_blank" /^> >>more.htmlecho ^<meta content="text/html; charset=utf-8" /^> >>more.htmlecho ^<head^> >>more.htmlecho ^<title^>contents^</title^> >>more.htmlecho ^<linkhref=https://www.isolves.com/it/cxkf/yy/C/2022-03-15/more.css" rel="stylesheet" type="text/css" /^> >>more.htmlecho ^^ >>more.htmlecho ^^
>>more.htmlfor /f "tokens=1,2 usebackq delims=." %%a in (`dir/o:n /b`) do ( if "%%a.%%b"=="%%a." (echo ^^^%%a^^^ >>more.html ))for /f "tokens=1,2 usebackq delims=." %%a in (`dir/o:n /b`) do ( if not "%%a.%%b"=="%%a." ( if not "%%a.%%b"=="more.html" ( if not "%%b"=="bat" (if "%%b"=="html" (echo ^^%%a^^ >>more.html) ) ) ))for /f "tokens=1,2 usebackq delims=." %%a in (`dir/o:n /b`) do ( if not "%%a.%%b"=="%%a." ( if not "%%a.%%b"=="more.html" ( if not "%%b"=="bat" (if not "%%b"=="html" (echo ^^%%a.^%%b^^^ >>more.html) ) ) ))echo ^
>>more.htmlecho ^ >>more.htmlecho ^