|
|
vijaylaxmi wrote: how can i get this code from internet.
Rumor has it that vijaylaxmi has a VS2005 SDI project that will spilt MP3 files into small pieces. It sounds like just what you are looking for.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
//m_Path=input path
//m_Path2=output path
fstream rfile(m_Path,ios::in|ios::binary);//input file
fstream wfile(m_Path2,ios::out|ios::binary);//output file
//SeekPos is a starting location from where i start reading.
//SeekPos is a ending location till that i read.
char buffer[200000];
for(SeekPos;SeekPos<=SeekPos2;SeekPos++)
{
//rfile.get(ch);//if i read as character wise.
//wfile.put(ch);
rfile.read(buffer,sizeof(buffer));read from buffer
wfile.write(buffer,sizeof(buffer));
wfile.flush();
rfile.flush();
}
rfile.close();
wfile.close();
i m using this code,but itis not working properly.plz tell me right code.
|
|
|
|
|
You don't like the CopyFile [^] function?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
no,becoz i m not want to copy whole file i want copy selected part of file.
|
|
|
|
|
One of my very first C programs (before Windows 286) was a "file copier" where bytes were read/written in such a loop. I thought it was the coolest thing since sliced bread. I would spend hours benchmarking it against several files just to watch it go.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: One of my very first C programs (before Windows 286) was a "file copier" where bytes were read/written in such a loop. I thought it was the coolest thing since sliced bread. I would spend hours benchmarking it against several files just to watch it go.
and since it has been included in the OS , it is known as FileCopy function.
Anyway I guess the OP lacks such motivations.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
vijaylaxmi wrote: itis not working properly.
Tell us why and maybe we'll be able to offer suggestions. Unless you are bent on having a for loop to read X bytes at a time until you reach SeekPos2 , why not set up a buffer big enough to hold SeekPos2-SeekPos bytes and call Read() once?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
CString str;
unsigned long k=10000;
str.format("%?",str);
Thanks
|
|
|
|
|
SenToMessage wrote: str.format("%?",str);
Use %lu
But str.format("%lu",k); not str
|
|
|
|
|
|
what about checking the CString documentation first ?
how ?
open msdn.com first and make a search on CString class members.
reach Format(), and there you go.
the harder part is for now. read what's there, and understand it !
|
|
|
|
|
You're a rather rude guy!
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
that was a pretty stupid question. the guy already knows the syntax will be omething like %? but he is too lazy to search the exact form.
so, i'm as lazy as him...
|
|
|
|
|
toxcct wrote: hat was a pretty stupid question. the guy already knows the syntax will be omething like %? but he is too lazy to search the exact form.
indeed.
toxcct wrote: so, i'm as lazy as him...
No, he far beated you on laziness.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
toxcct wrote: what about checking the CString documentation first ?
LMAO....You're kidding, right?
Tox, Tox, Tox *shaking-head-in-disbelief*
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I want to read my audio file as a binary file.
i opned my file in binary mode and than start reading from file but there is a problem after reading of one line the pointer is not read from file how can it possible plz tell me.
appericiate every answer.
thanks and regards
vijay laxmi
|
|
|
|
|
How do you read the file? Can you show the code?
|
|
|
|
|
//m_Path=input path
//m_Path2=output path
fstream rfile(m_Path,ios::in|ios::binary);//input file
fstream wfile(m_Path2,ios::out|ios::binary);//output file
//SeekPos is a starting location from where i start reading.
//SeekPos is a ending location till that i read.
char buffer[200000];
for(SeekPos;SeekPos<=SeekPos2;SeekPos++)
{
//rfile.get(ch);//if i read as character wise.
//wfile.put(ch);
rfile.read(buffer,sizeof(buffer));read from buffer
wfile.write(buffer,sizeof(buffer));
wfile.flush();
rfile.flush();
}
rfile.close();
wfile.close();
i m using this code plz tell me
|
|
|
|
|
What a mess!
vijaylaxmi wrote: for(SeekPos;SeekPos<=SeekPos2;SeekPos++)
vijaylaxmi wrote: rfile.read(buffer,sizeof(buffer));read from buffer
You're asking to read about 195 Kb from your file.
You need anyway to check for the failbit status after the reading operation.
vijaylaxmi wrote: wfile.write(buffer,sizeof(buffer));
You need to write (I suppose this is your requirement) only the effective number of bytes read.
And so on...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
basicaly i want to read a audio file length of this file is not confirm it is any thing.
my aim is read this file in binary mode and write in any othe file.
|
|
|
|
|
vijaylaxmi wrote: for(SeekPos;SeekPos<=SeekPos2;SeekPos++)
vijaylaxmi wrote: rfile.read(buffer,sizeof(buffer));read from buffer
You are reading the data of size 200000 bytes at a time, but SeekPos is incremented by 1. Why?
vijaylaxmi wrote: rfile.read(buffer,sizeof(buffer));read from buffer
wfile.write(buffer,sizeof(buffer));
Why? The read data may be less than the size of buffer when the reading is near to end.
So only the read bytes should be written, unless you are so sure about the read data size.
|
|
|
|
|
i dont how can it done,
plz can u send me code for this.
|
|
|
|
|
Why don't you search for a free tool to accomplish the task. Google is you best friend.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|