Note that there are some explanatory texts on larger screens.

plurals
  1. POC/Java - Read 2 files write in one
    primarykey
    data
    text
    <p>I need help with subtitles =)</p> <p>I have two .srt files with subtitles. One is in English and the other in Slovene. The problem is that the file in Slovene doesn't have the right time code, so subtitles are quicker than actual line. What I want to do is to write a program that reads both files, take the number of subtitle and the timecode from <em>eng.srt</em> file and the subtitles from <em>slo.srt</em> file and writes all that in <em>complete.srt</em>. I don't care about if its in Java or C. I am currently trying to write the program in C and I would appriciate any help.</p> <p>Now to demonstrate it what I want to do:</p> <pre><code>eng.srt (right timecode) 1 00:00:01,259 --&gt; 00:00:03,734 &lt;i&gt;Previously on...&lt;/i&gt; 2 00:00:03,746 --&gt; 00:00:06,910 &lt;i&gt;Tom and Lynette drifted further apart,&lt;/i&gt; 3 00:00:06,911 --&gt; 00:00:09,275 &lt;i&gt;and Jane took advantage.&lt;/i&gt; 4 00:00:09,440 --&gt; 00:00:10,670 I'm scared. 5 00:00:10,671 --&gt; 00:00:13,362 &lt;i&gt;Roy helped Karen face her cancer.&lt;/i&gt; slo.srt (right subtitles) 1 00:00:00,009 --&gt; 00:00:02,484 &lt;i&gt;Prejšnič...&lt;/i&gt; 2 00:00:02,496 --&gt; 00:00:05,660 &lt;i&gt;Tom and Lynette sta se še bolj odtujila,&lt;/i&gt; 3 00:00:05,661 --&gt; 00:00:08,025 &lt;i&gt;in Jane je to izkoristila.&lt;/i&gt; 4 00:00:08,190 --&gt; 00:00:09,420 Strah me je. 5 00:00:09,421 --&gt; 00:00:12,112 &lt;i&gt;Roy se je pomagal Karen soočiti z rakom.&lt;/i&gt; complete.srt (where i write) 1 00:00:01,259 --&gt; 00:00:03,734 &lt;i&gt;Prejšnič...&lt;/i&gt; 2 00:00:03,746 --&gt; 00:00:06,910 &lt;i&gt;Tom and Lynette sta se še bolj odtujila,&lt;/i&gt; ... </code></pre> <p>This is what i have so far (i open 3 files, i will be updating my work as i go):</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; int main() { char ch, sf1[20], sf2[20], tf[20]; FILE *source1, *source2, *target; //first source file printf("Enter name of first source file\n"); gets(sf1); source1 = fopen(sf1, "r"); //seconds source file printf("Enter name of second source file\n"); gets(sf2); source2 = fopen(sf2, "r"); if( source == NULL ) { printf("Press any key to exit...\n"); exit(EXIT_FAILURE); } //target file printf("Enter name of target file\n"); gets(tf); target = fopen(tf, "w"); if( target == NULL ) { fclose(source); printf("Press any key to exit...\n"); exit(EXIT_FAILURE); } printf("File writen successfully.\n"); fclose(source1); fclose(source2); fclose(target); return 0; } </code></pre> <p>My problem is that I don't know how to tell the program to read only the numbers from <em>eng.srt</em> file, and than skip the subtitle part and wait, than read the <em>slo.srt file</em> take out subtitles and skip the numbers.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload