VB icon

mp3 splitter

Email
Submitted on: 1/2/2015 9:52:00 AM
By: theMayor (from psc cd)  
Level: Beginner
User Rating: By 3 Users
Compatibility: C++ (general)
Views: 475
 
     I had a problem when downloading mp3's. With no cd burner or network i couldn't get my mp3's to a friends house. So i made an mp3 splitter. A normal 4.0 mb song could fit on three disks. but it this splitter can support up to 30 mb's. I doubt any song is longer than that
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
//**************************************
// Name: mp3 splitter
// Description:I had a problem when downloading mp3's. With no cd burner or network i couldn't get my mp3's to a friends house. So i made an mp3 splitter. A normal 4.0 mb song could fit on three disks. but it this splitter can support up to 30 mb's. I doubt any song is longer than that
// By: theMayor (from psc cd)
//**************************************

#include <stdio.h>
#include <iostream.h>
#include <fstream.h>
#include <string>
int main(int argc, char *argv[])
{
 int filesize=140000;// This is approximatley 1.4 mb's. Change this to fit your needs
 char * charachters[]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
 int fname=0;
 FILE *in;
 FILE * splitted;
 ofstream bat ("combine.bat");
 int bcounter=0;
 unsigned int filenum;
 unsigned char ch;
 if(argc == 1)
 {
cout << "\nneed file\n";
return 0;
}
 in = fopen(argv[1], "rb");
 bat << "copy /b a";
 ch = (char) getc(in);
 splitted=fopen(charachters[fname],"wb");
 for(filenum=0; !feof(in); filenum++)
 {
if (filenum%filesize==0 && filenum!=0)
{
 fclose(splitted);
 fname++;
 bat << "+"<<charachters[fname];
 splitted=fopen(charachters[fname],"wb");
}
fputc(ch,splitted);
cout << ch;
ch = (char) getc(in);
}
bat << " "<<argv[1];
bat.close();
fclose(in);
fclose(splitted);
return 1;
}


Other 6 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.