首页 > 代码库 > a c lang in linux
a c lang in linux
#include <iostream>#include <string.h>#include <stdlib.h>#include <stdio.h>using namespace std;int main(int argc, char *argv[]){char cl = ‘A‘;cout << ‘W‘ << ‘ ‘;cout << cl << endl;cout << "this is a test." << endl;cout << "----------" << endl;char *name="howareyou";char ch;FILE *fp;if((fp=fopen("./bs.txt","r"))==NULL){ cout << "err"<<endl;} ch=fgetc(fp); while(ch!=EOF) { if(ch==‘\n‘) cout<< "a new line"<<endl; putchar(ch); ch=fgetc(fp); } printf("I need %s %d",name,5);string path="\\home";cout << path;return 0;}char* readline(FILE* f){ char* line = (char*) calloc(1, sizeof(char) );; char c; int len = 0; while ( (c = fgetc(f) ) != EOF && c != ‘/n‘) { line = (char*) realloc(line, sizeof(char) * (len + 2) ); line[len++] = c; line[len] = ‘/0‘; } return line;}
a c lang in linux
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。