⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index写成二进制文件.txt

📁 一些解决线形方程组的并行计算的程序,希望对大家有一点帮助
💻 TXT
字号:
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <fstream>
using namespace std;
int InputIndexFile(const char *  pcInFile,const char*  pcOutFile)
{
  FILE  *fp;//define the open file point
  FILE  *bp;//define the writer file point

  char  buffer[40]; //putinto every line
  int i=0;
  if((fp=fopen(pcInFile,"r"))==NULL)//open the index file
  {
    printf("can not open the index file.please check your file path!\n ");
    exit(0);
  }
  if((bp=fopen(pcOutFile,"wb"))==NULL)//create a file
  {
    printf("can not  open the file~!\n");
    exit(0);
  }
  while(fgets(buffer,40,fp))
  {
   // fgets(buffer,30,lp);//get strings and put them into buffer
    printf("%s",buffer);
    fwrite(buffer,1,40,bp);//write a  bin file
   i=i+1;
   }

  fclose(fp);
  printf("write successfully,%d Line\n",i);
  fclose(bp);

   return 0; 
}
int  main()
{ 

  string InFile;
  string OutFile;
  cout<<"please  input your file nane:"<<endl;
  cin>>InFile;
  cout<<"pease input your outfile name :"<<endl;
  cin>>OutFile;
  const  char *pInFile=0;
  const char *pOutFile=0;
  pInFile=InFile.c_str();//string convert ti  const  char*
  pOutFile=OutFile.c_str();
  InputIndexFile(pInFile,pOutFile);
  
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -