hi,
i just started to learn c++
so ill start with the big question-
i want to make a mp3 cutter which will get an mp3 file, starting time,ending time and new filename - and save a new mp3 .
so..how do i start? i searched google for libraries ...but didnt know what to look for or where...
i know the syntex, and a lil bit from std (like fstream, and strings, and arrays and loops and all)
the 2nd project im working on (one in the office and one at home)
is a simple reading data from one file and displaying it
what i need to display is a part of the first line of the file, a part of the last line
and the number of lines.
i made a code like this (which i suppose should output the first and last lines and line number):
Code:
ifstream fin;
fin.open("c:\\somefile.txt")
string line;
getline(fin,line);
cout<<"The first line is :\n"<<line;
int counter = 1;
while (!fin.eof())
{
getline(fin,line);
counter += 1;
}
cout<<"The last line is :\n"<<line<<"\nThe number of lines :"<<counter<<endl;
the problem with this code was the last line was empty (when it wasnt - and i tried saving the last 3 lines each time, and i found out the last line was the one before the last getline...
when in fact there was no empty line at the end...)
so 2 questions - the first: how do i get the last line without saving 2 lines at a time?
the second question : how do i get only a defined part of a string? (like from the 4th character to the 14th character)
Thank you
Roy
Edit - how can i delete one post? it posted it twice for some reason