Alright, just so you know - everything works fine. Basically, the program takes timecodes (in the format [MM:SS] seperated by newlines) in a textfile, and adds them up, and posts the total in a new textfile (in the form HH:MM:SS.000). I had a lot of trouble seperating the commandline arguments, but I think I have it.
Basically, if you just run the file by double clicking it, it asks you to input the filename (or filepath)... If you drag a file onto it, it processes it automatically. The thing is, I had a lot of trouble with the backslash (\), having to turn it into \\ for the filepath ONLY when it's taken as an argument.
So I attached the code, and a sample file (e.txt, which is the chapter list for Apocalypse Now), and the source code. Basically, to get the filename right, I turned it into a string, found all of the backslashes, added another, got the string length, allocated some memory for a new character array, and streamed it back one character at a time... For some reason, I think there was an easier way to do it - I just needed the program to work for now.
I want to know how to optimize it now though; or if I did anything wrong.
Question
Breakthrough
Alright, just so you know - everything works fine. Basically, the program takes timecodes (in the format [MM:SS] seperated by newlines) in a textfile, and adds them up, and posts the total in a new textfile (in the form HH:MM:SS.000). I had a lot of trouble seperating the commandline arguments, but I think I have it.
Basically, if you just run the file by double clicking it, it asks you to input the filename (or filepath)... If you drag a file onto it, it processes it automatically. The thing is, I had a lot of trouble with the backslash (\), having to turn it into \\ for the filepath ONLY when it's taken as an argument.
So I attached the code, and a sample file (e.txt, which is the chapter list for Apocalypse Now), and the source code. Basically, to get the filename right, I turned it into a string, found all of the backslashes, added another, got the string length, allocated some memory for a new character array, and streamed it back one character at a time... For some reason, I think there was an easier way to do it - I just needed the program to work for now.
I want to know how to optimize it now though; or if I did anything wrong.
Thanks! :)
e.txt
timeconv_SRC.txt
Link to comment
Share on other sites
1 answer to this question
Recommended Posts