#include <string>
#include <iostream>
#include <fstream>
#include <algorithm>
void main()
{
FILE *fp;
int count=0;
const int ARRAY_SIZE = 256;
char buff[ARRAY_SIZE];
int *location;
fp=fopen("1.txt","r");
std::string strWholeLine = "";
bool bNotEnd = false;
while(fgets(buff, ARRAY_SIZE, fp) != NULL)
{
std::string strc = buff;
size_t stIndex = strc.find("/n");
if (feof(fp))
{
++count;
std::cout << count << ": " << strc /*<< std::endl*/;
}
else if (stIndex != std::string::npos)
{
++count;
if (!bNotEnd)
{
std::cout << count << ": " << strc /*<< std::endl*/;
}
else
{
strWholeLine += buff;
std::cout << count << ": " << strWholeLine /*<< std::endl*/;
bNotEnd = false;
strWholeLine = "";
}
}
else
{
bNotEnd = true;
strWholeLine += buff;
}
}
fclose(fp);
}