求大神 代码 如何自定义函数写出分行提取代码
// ConsoleApplication1.cpp : Defines the entry point for the console application.//
#include "stdafx.h"
#include <math.h>
int main()
{
FILE *stream, *stream2;
double output,n,s;
errno_t err;
err = fopen_s(&stream, "D://input.dat.txt", "r" );
if( err == 0 )
{ printf( "The file myFile.dat was opened\n" ); }
else
{ printf( "The file myFile.dat wasn’t opened\n" ); }
output = fscanf_s(stream, "%lf %lf", &n,&s);
while (output != EOF) {
printf_s("%f %f\n", n, s);
output = fscanf_s(stream, "%lf %lf", &n, &s);
}
int numclosed = _fcloseall();
printf("Number of files closed by _fcloseall: %u\n", numclosed);
return 0;
}
求自定义函数写出n,s的单独一行的值,进行验证然后取出下一行n,s的值 在进行验证