|
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]
|
|
|
|
|
|
And how did you try to read?
|
|
|
|
|
//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();
|
|
|
|
|
vijaylaxmi wrote: rfile.read(buffer,sizeof(buffer));read from buffer
wfile.write(buffer,sizeof(buffer));
Maybe you should start with a less ambitious project until you learn about return values and such.
Have you considered something like:
std::istream i = rfile.read(buffer, sizeof(buffer));
wfile.write(buffer, i.gcount());
"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
|
|
|
|
|
|
|
Dont need to repeat your question.
|
|
|
|
|
Hi ALL,
I doing project in VC++ 6.0 in which i am creating web page
tool. This tool is used to create web page. I want to add the feature of creating multiple web pages at a time, same like MS front page. So is it possible to create multiple web pages and save them in SDI application. please let me know whether it is possible or not.
Thanks in Advance
at
|
|
|
|
|
how to check the current position of a file handle is EOF or not, the file handle is opened using CreateFile() API.
my project type is Win32 Application
thanks
|
|
|
|
|
You can use of CFile::Seek for get current position.
|
|
|
|
|
That's MFC Hamid, you're cheating!
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]
|
|
|
|
|
CPallini wrote: That's MFC Hamid, you're cheating!
Maxwell Chen
|
|
|
|
|
|
IMHO you have to perform a reading operation and check ReadFile return value and its out parameter lpNumberOfBytesRead , MSDN [^] states:
If the return value is nonzero and the number of bytes read is zero (0), the file pointer is beyond the current end of the file at the time of the read operation.
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]
|
|
|
|
|
Hint: SetFilePointer will help you.
|
|
|
|
|
nitin3 wrote:
how to check the current position of a file handle is EOF or not, the file handle is opened using CreateFile() API.
It depends on the operaton most recently performed on the file (handle). As has been stated already, ReadFile() will return a value indicating if the requested number of bytes were read. If not, then you know that EOF was encountered.
"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
|
|
|
|
|
Give you a MSDN sample:
The following code example tests for end-of-file for a synchronous read operation.
bResult = ReadFile(hFile, <br />
&inBuffer, <br />
nBytesToRead, <br />
&nBytesRead, <br />
NULL) ; <br />
if (bResult && nBytesRead == 0) <br />
{ <br />
}
A Chinese VC++ programmer
|
|
|
|
|
Hi all
<br />
<br />
CImageList imageList; <br />
<br />
imageList.Create(size.cx, size.cy, ILC_MASK | ILC_COLOR24, 0, 1 <br />
imageList.Add(&myBitmap, RGB(255,255,255<br />
<br />
CPoint pt(20,20); <br />
<br />
imageList.Draw(&dc,0,pt,ILD_TRANSPARENT);<br />
These are myself's picture code in OnPaint,
at the (20,20), I put an other control(button or edit), and that the other control had covered myself's picture.
How can let myself's picture cover other control?
|
|
|
|
|
You need to draw the image over other controls?
|
|
|
|
|
From where are you doing this drawing? Can you edit control or button be moved to another location? Can the drawing be done elsewhere on the dialog? Rather than draw directly on the dialog, can you draw on a static control or a button instead?
"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
|
|
|
|
|
Control windows on the dialog are higher in the z-order than the
dialog window itself so they get painted later.
You need a window higher in the z-order than the control you
want to paint over (see DavidCrow's reply).
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|