打开文件
来源:百度文库 编辑:神马文学网 时间:2024/06/03 14:15:23
//
#include "stdafx.h"
#include
#include
#include int main()
{
FILE *in;
in = fopen("E:\\123.txt", "r");
char line[256], buf[32];
char *token = 0;
while(fgets(line, 255, in))
{
token = strtok(line, " ");
while(token)
{
printf("%s ", token);
token = strtok(NULL, " ");
}
}
return 0;
} char *strtok(char *s, char *delim);//s为要分解的字符串,delim为分隔符字符串。 首次调用时,s指向要分解的字符串,之后再次调用要把s设成NULL。 strtok在s中查找包含在delim中的字符并用NULL('')来替换,直到找遍整个字符串。 char * p = strtok(s,";"); p = strtok(null,";"); 在调用的过程中,字串s被改变了,这点是要注意的。
//***********************
#include "stdafx.h"
#include
#includeusing namespace std;int main()
{
ifstream myFile;
myFile.open("E:\\123.txt");
char output[100];
if (myFile.is_open())
{
while (!myFile.eof())
{
myFile >> output;
cout<
#include "stdafx.h"
#include
#include
#include
{
FILE *in;
in = fopen("E:\\123.txt", "r");
char line[256], buf[32];
char *token = 0;
while(fgets(line, 255, in))
{
token = strtok(line, " ");
while(token)
{
printf("%s ", token);
token = strtok(NULL, " ");
}
}
return 0;
} char *strtok(char *s, char *delim);//s为要分解的字符串,delim为分隔符字符串。 首次调用时,s指向要分解的字符串,之后再次调用要把s设成NULL。 strtok在s中查找包含在delim中的字符并用NULL('')来替换,直到找遍整个字符串。 char * p = strtok(s,";"); p = strtok(null,";"); 在调用的过程中,字串s被改变了,这点是要注意的。
//***********************
#include "stdafx.h"
#include
#include
{
ifstream myFile;
myFile.open("E:\\123.txt");
char output[100];
if (myFile.is_open())
{
while (!myFile.eof())
{
myFile >> output;
cout<
打开文件
常见文件打开方式
gbp文件怎么打开?
常见文件打开方式
文件的打开方式
如何打开隐藏文件
cdr文件如何打开
文件重命名后文件不能打开
分类.*后缀文件怎么打开?
打开隐藏文件的方法
打开文件返回二进制数组
如何打开隐藏文件123
怎样打开扩展名.xlsm文件?
文件后缀名和打开方式
电脑里常见文件的打开方式(打开程序)
电脑里常见文件的打开方式(打开程序)
常见文件后缀名及其打开方式
HTML利用超链接打开链接文件
电脑里常见文件的打开方式
别让打开文件对话框总是老样子
各种文件后缀名与打开方式大全
常见文件后缀名及其打开方式
揭示秘密 打开隐藏文件的方法
HTML利用超链接打开链接文件