subtitle time delay (school assigment)

Hello, in school I got this assigment to write a program that reads text from file and copies it to another file, removing the html signs. It should also be able to Delay whole subtitles for X seconds or only interval (given by user). I dont know how to do this delay.
It should also be able to convert .srt to .sub in vice-versa but this is not so important

this is my code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <iostream.h>
#include <fstream.h>
#include <string.h>

int main(){
    ifstream vhod; //input
    ofstream izhod; //output 
    char ime_vhod[30], ime_izhod[30]; //names of input and output
    int spy=2;
    
    
    cout<<"Ime vhodne datoteke: "<<endl; ///user gives names of input and output file.
    cin>>ime_vhod;
    cout<<"Ime izhodne datoteke: "<<endl;
    cin>>ime_izhod;
    strcat(ime_izhod, ime_vhod);
    
    vhod.open(ime_vhod);
    if (!vhod.good()){
        cout<<"Prislo je do napake !"<<endl;
        
    }
    izhod.open(ime_izhod);
    
    char znak;
    
    while(!vhod.eof()){    ///my yucky way of getting rid of html tags
        znak=vhod.get();
        
         
        if(znak=='<'){
            spy=1;
          
            
        }
        if(znak=='>'){
          spy=2;
           znak=' '; 
            }
        
        if(znak=='>'){
            spy=2;
            
            
        }
        if(spy==1){
            izhod.put(' ');
           
            
        }
        if(spy==2){
            izhod.put(znak);
        }

    }
    cout<<znak;
    vhod.close();
    izhod.close();
}
In time.h there is a clock function. You can use that.
in <windows.h> you can use sleep(x).
There is no sleep() function in windows. Windows uses Sleep() function. Mind the capital "S".
Topic archived. No new replies allowed.