69,381
社区成员
发帖
与我相关
我的任务
分享
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
int main()
{
ifstream in("1.txt", ios::in);
ofstream out("2.txt", ios::out);
string str;
while(in&&in>>str)
{
out<<str;
}
return 0;
}
#include<stdlib.h>
#include<stdio.h>
#include<string.h>
int main()
{
FILE *fp = fopen("test.txt" , "r");
char buffer[1024];
memset(buffer , '\0' , sizeof(buffer));
int size = fread(buffer,sizeof(char) ,1024 , fp);
for(int i=0;i<size;i++)
{
if(buffer[i] == ' ' || buffer[i] == '\n')
continue;
else
printf("%c" , buffer[i]);
}
return(0);
}