64,649
社区成员
发帖
与我相关
我的任务
分享
0.5">If you are a premiere member of the lynda.com online training library, or if you
5.19">are watching this tutorial on a DVD, you have access to the exercise files used throughout the title.
1
00:00:00,500 --> 00:00:05,190
If you are a premiere member of the lynda.com online training library, or if you
2
00:00:05,190 --> 00:00:11,800
are watching this tutorial on a DVD, you have access to the exercise files used throughout the title.
TCHAR szFilter[]=_T
("文本文件(*.txt)|*.txt|所有文件(*.*)|*.*||");
CFileDialog dlg(TRUE,NULL,NULL,OFN_FILEMUSTEXIST|OFN_HIDEREADONLY, szFilter);
if (dlg.DoModal()==IDOK)
{
edit1 = dlg.GetPathName();
fileName = dlg.GetFileTitle();
SetWindowText(fileName);
SetDlgItemText(IDC_EDIT1,edit1);
UpdateData(FALSE);
}
//文本文件in.txt,格式:
//0.5">If you are a premiere member of the lynda.com online training library, or if you
//
//5.19">are watching this tutorial on a DVD, you have access to the exercise files used throughout the title.
//
//11.8">
//转为文本文件out.txt格式:
//1
//00:00:00,500 --> 00:00:05,190
//If you are a premiere member of the lynda.com online training library, or if you
//
//2
//00:00:05,190 --> 00:00:11,800
//are watching this tutorial on a DVD, you have access to the exercise files used throughout the title.
//
#include <stdio.h>
#include <string.h>
#include <math.h>
char fileName[256]="in.txt";
char ln1[4096],*p1;
char ln2[4096];
int n1,n2,i;
double t1,t2;
int main() {
FILE *fi,*fo;
fi=fopen(fileName,"r");
if (NULL==fi) {
printf("CAn not open file %s\n",fileName);
return 1;
}
i=0;
fo=fopen("out.txt","w");
if (NULL==fgets(ln1,4096,fi)) goto SKIP;
if (1!=sscanf(ln1,"%lf\">%n",&t1,&n1)) goto SKIP;
p1=ln1+n1;
while (1) {
if (NULL==fgets(ln2,4096,fi)) break;
if (1==sscanf(ln2,"%lf\">%n",&t2,&n2)) {
i++;
fprintf(fo,"%d\n%02d:%02d:%02d,%03d --> %02d:%02d:%02d,%03d\n%s\n",
i,
(int)floor(t1)/3600,(int)floor(t1)/60%60,(int)floor(t1)%60,(int)((t1-floor(t1))*1000.0),
(int)floor(t2)/3600,(int)floor(t2)/60%60,(int)floor(t2)%60,(int)((t2-floor(t2))*1000.0),
p1
);
strcpy(ln1,ln2);
p1=ln1+n2;
t1=t2;
}
}
SKIP:
fclose(fo);
fclose(fi);
return 0;
}
//文本文件in.txt,格式:
//0.5">If you are a premiere member of the lynda.com online training library, or if you
//
//5.19">are watching this tutorial on a DVD, you have access to the exercise files used throughout the title.
//
//11.8">
//转为文本文件out.txt格式:
//1
//00:00:00,500 --> 00:00:05,190
//If you are a premiere member of the lynda.com online training library, or if you
//
//2
//00:00:05,190 --> 00:00:11,800
//are watching this tutorial on a DVD, you have access to the exercise files used throughout the title.
//
#include <stdio.h>
#include <string.h>
#include <math.h>
char fileName[256]="in.txt";
char ln1[4096],*p1;
char ln2[4096];
int n1,n2,i;
double t1,t2;
int main() {
FILE *fi,*fo;
fi=fopen(fileName,"r");
if (NULL==fi) {
printf("CAn not open file %s\n",fileName);
return 1;
}
i=0;
fo=fopen("out.txt","w");
if (NULL==fgets(ln1,4096,fi)) goto SKIP;
if (1!=sscanf(ln1,"%lf\">%n",&t1,&n1)) goto SKIP;
p1=ln1+n1;
while (1) {
if (NULL==fgets(ln2,4096,fi)) break;
if (1==sscanf(ln2,"%lf\">%n",&t2,&n2)) {
i++;
fprintf(fo,"%d\n%02d:%02d:%02d,%03d --> %02d:%02d:%02d,%03d\n%s\n",
i,
(int)floor(t1)/3600,(int)floor(t1)/60%60,(int)floor(t1)%60,(int)((t1-floor(t1))*1000.0),
(int)floor(t2)/3600,(int)floor(t2)/60%60,(int)floor(t2)%60,(int)((t2-floor(t2))*1000.0),
p1
);
strcpy(ln1,ln2);
p1=ln1+n2;
}
}
SKIP:
fclose(fo);
fclose(fi);
return 0;
}