C
C
CMETAHAA2016-03-12 19:15:01
C++ / C#
CMETAHAA, 2016-03-12 19:15:01

How to read the necessary lines and copy?

I’ll say right away that I’m not strong in C ++, I sketched the code from the sources (from the Internet), I pull out the data from the file, everything works as it should.
You need to skip 4 lines and copy the data further down the list.

#include <iostream>                                   // для оператора cout
#include <cstdio>                                     // для функции rename
#include <sys/stat.h>
#include <fstream>
using namespace std; 
int main()
{   
    mkdir ("/var/www/hls/live.m3u8", 0775);
    ifstream infile;
    ofstream outfile;
 
    infile.open("/var/www/hls/55/live.m3u8");
    outfile.open("/var/www/hls/live.m3u8");
 
    char buffer[1000];         
    while(!infile.eof())       
    {
        infile.getline(buffer,sizeof(buffer));         
        outfile<<buffer<<endl;                  
    }
 
    infile.close();         
    outfile.close();    
    return 0;
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question