当前位置: 首页 > news >正文

做视频上传到网站怎么赚钱案例学 网页设计与网站建设

做视频上传到网站怎么赚钱,案例学 网页设计与网站建设,保险公司招聘网站,wordpress设置主页write in advance 最近在做题#xff0c;遇到一个简单的将console的输入输出到文件中的简单题目#xff0c;没有写出来。悔恨当初没有踏实地总结string 相关的 I/O 以及与文件的操作。这篇文章旨在记录基础的字符I/O, 简单常用的文件I/O操作函数。 当然#xff0c;你会说C…write in advance 最近在做题遇到一个简单的将console的输入输出到文件中的简单题目没有写出来。悔恨当初没有踏实地总结string 相关的 I/O 以及与文件的操作。这篇文章旨在记录基础的字符I/O, 简单常用的文件I/O操作函数。 当然你会说C 已经有一个string class我们只需要#includestring就能够使用它带来的便捷性及强大的功能无需烦恼细节。 但知道底层的具体情况在语言的学习阶段很重要有利于打好基础。说不定以后需要自己写一个类似的string类呢此外#include的方式包含头文件会包含头文件中的所有信息而有时我们可能只会用到其中的一小部分这会使我们的文件变得很大。或者我们可以自己写一个只包含我们目前需要用的。当然那是有一定积累之后的事情了。 此处我会试着提供一些代码片段(code snippet)作为例子。 简单的Input 函数 此处比较std::cin.get()函数理解function overloading 概念。 function overloading指允许同名不同参数列表的函数存在以不同的方式或不同的参数类型执行相同的基础操作。要重载一个函数你必须提供不同的参数列表。 //function prototype int std::cin.get(char ); // read a char argument, return a int type std::cin std::cin.get(char*,int); // line-oriented function std::cin std::cin.get(char ch); // the argument is char, a reference // any change to the ch modifys the original variable// a simple output method std::cout.put(char ); // display the type char character 此处给出几个简单的 line-oriented funcitons. // both used to read a line, the so-called line-oriented method // first argument is the name of the target, the second argument is a limit // on the number of characters to be read// when meeting the newline character, they behave differently std::cin.get(char*, int ); // leave the newline character in the intput queue std::cin.getline(char*, int ); // discards the newline character// stop reading input when they reach the numeric limit or when they meet // a newline character, whichever comes first.std::cin.get() // read the single next character, including the newline character // it can be used to dispose of the newline character. 两种方法都能够读取一整行内容。  相比之下getline() 更简单get()更有利于错误检查。 when std::cin.getline() or std::cin.get() reads an empty line, both sets the failbit, which block further input. To recover from the state , std::cin.clear(); is needed. if the input line is longer than the num, std::cin.getline()  set the failbit and turn off further input while std::cin.get() do nothing. In additon, both of them leave the remaining characters in the input queue.  once again, the failbit block further input, which should be reset through statement std::cin.clear(); 值得注意到是当混合数字、字符串输入时有时也会遇到 failbit 阻止更多输入的情况。这种情况下同样需要使用 std::cin.clear();  此处也能够将两个式子连接起来因为函数的返回值为 std::cin 对象。 //both them returns a cin object std::cin.get(char*,int); std::cin.getline(char* int);// so statement like this is available std::cin.get(char*,int).get(); std::cin.getline(char*,int).get();// in this situation, it is the concatenationstring class 中同样存在读取一整行的函数getline(), 它的两个参数及其意义与 std::cin.getline(char*,int )并不相同。第一个参数说明输入的来源此处是控制台输入也可以是文件输入第二个参数说明要输入哪个string 对象。 注意到getline()是一个函数不是方法这是友元函数的概念。 #includestring string str; getline(std::cin, str); // a string class object to read a line// it is a friend function, neednt to take care about the size// cause the stirng class automatically resize when change occure std::ifstream fin; fin.open(mytest.txt); // assume there exist a mytest.txt file, and it is not empty getline(fin, str); // read a line from mytest.txt to str 以上是简单的line-oriented functions后续也许会补充。 文件相关的 Input 函数 #includeiostream #includefstream // for file I/Ostd::ifstream infile; std::ofstream outfile; infile.open(test.txt); infile.clost(); // outfile is the same//check infile.is_open(); // true if the file is open successfully infile.good(); // input is good and not at EOF infile.eof(); // return true when encounter the EOF infile.fail(); // return ture when encounter the EOF // or when type mismatch, whichever come first 注意图中给出了部分用于定位错位原因方便调试。 summary line-oriented functions 读取一行输入可以简单理解为读取句子。它和读取单词一样都是字符串输入的简单函数。 文件是通常情况下我们需要使用的部分。与文件有关的I/O读写也是必须掌握的基础知识。 重定向 redirection 概念在console and file 的交互中产生。我们不仅能从standard input你的键盘读取输入也能从文件中类似的不仅能将结果输出到 console 你的显示屏也能输出到文件中。 现在回看这篇文章实际内容并不多是零零碎碎的语法总结。更多的目的是为了防止以后再出现对简单问题无法正确答出的愚蠢情况。 后期在更深入了解字符类的输入输出后会重新回来更新这部分的内容。 added 编程语言 (C, Python...)与文件有关的操作还与文件的格式、内部的书写相关。须知.txt文件是最最简单的文本文件。而语言能对文件进行的操作也很繁多。比如 json文件, yaml文件urdf文件C自然能够对它们进行操作。对文件的操作包括解析文件格式提取特定内容等等部分对特殊格式的文件读取如解析json文件网络上就有开源的用纯C编写的项目是一项大工程。 所以这些简单的易得的不需要如何动脑子的函数细节自然需要牢固掌握日后遇到大项目才不需要哪里都是漏洞。
http://www.lakalapos1.cn/news/57097/

相关文章:

  • 美食静态网站设计论文免费网站自动跳转
  • 有哪些专做旅游定制的网站crm系统流程图
  • 免费网站建设有哪些wordpress5.2中文
  • 做断桥铝最知名的网站软件开发服务器
  • 湖南专业建站按效果付贿做业务在那几个网站上找客户端
  • 鲜花网站建设文档外贸有限公司英文网站
  • 哪个网站做推广效果好小时seo加盟
  • 网站外部链接辽宁省建设工程新希望官网
  • 网站加速免费重庆万州网站建设
  • 网站做哪些主题比较容易做深圳建筑设计师招聘信息
  • 重庆网站优化方式腾讯有做淘宝客网站吗
  • 做网站用phpcms还是蚌埠网站开发
  • 素材天下网站展览展示设计公司排名
  • 汕头网站公司传承网页设计公司
  • 做网站如何推销搜索引擎营销有哪些方式
  • 网站设计的公司概况简介如何做汉服
  • 做电影网站被抓wordpress登录空白页
  • 四川省建设厅网站川北医学院花园之家wordpress
  • 效能建设网站做本地的门户网站
  • 无锡网站建设365caiyi互联网保险销售行为可回溯管理
  • 卫生计生加强门户网站建设网站建设端口
  • 用jsp做婚纱网站的流程电话营销技巧和营销方法
  • 网络营销型网站策划机械零部件加工网
  • 国内外基于vue框架的网站建设现状建立网站所需费用项目清单
  • 微网站开发 培训免费自助建站哪个好
  • 自做网站打开速度慢展示型网站报价
  • 网站模板 源码之家聊城网站建设开发
  • 电商网站 设计方案软件网站开发团队名称
  • 网站与微信内容建设与运维总结京东网站设计风格
  • 做网站5年工资多少wordpress能制作视频网站吗