ahmed abdelwahab <[EMAIL PROTECTED]> wrote:
> Hi all
Howdy!
> I have a question
> I use "visual studio 6 (c++)"
Actually a rather nice compiler. I prefer that over
Visual Studio 2005 Express (which has no resource editor).
I use Visual Studio 6 at home for making windows apps.
> I want to read wave file in C and make a processing in it
> I search alot in this field but all code Habe error
> as:
> #include "ALLOC.H"
> #include "DOS.H"
> #include "MEM.H"
> #include "CONIO.H"
> #include "STDIO.H"
Looks like very, very old code from the DOS 5.0 era when
all file names were 8x3 in all-caps. All those headers
except stdio.h are non-std, and will only work with the
compiler for which the code was written. Try to find
code written for Microsoft Windows 2K and Visual Studio 6.
> some of this referance make error like ALLOC.H and MEM.H
Yes, your compiler likely doesn't have those headers, and
even if it does, they likely don't reference the same
library content. Porting non-portable code is a bitch,
ain't it? You'd need to re-impliement everything that
uses non-std lib. funcs. so that it uses only std-lib
funcs (or other libraries which you actually do have
available to you).
> and another code want
> #include<iostream.h>
> #include<fstream.h>
> #include<string>
> #include<conio.h>
> #include<file.h>
That's just plain wrong. Don't know where you got that.
Loose the bogus ".h" in the first two includes:
#include<iostream> // C++ IO streams
#include<fstream> // C++ file streams
#include<string> // C++ std::string
#include<conio.h> // non-std, but common
#include<file.h> // unknown
> void main()
> {
> FILE *fp;
> fp = fopen("sound.wav","rb);
> if(fp)
> {
> BYTE id[4]; //four bytes to hold 'RIFF'
> DWORD size; //32 bit value to hold file size
> fread(id,sizeof(BYTE),4,fp); //read in first four bytes
> if (!strcmp(id,"RIFF"))
> { //we had 'RIFF' let's continue
> fread(size,sizeof(DWORD),1,fp);
> //read in 32bit size value
> }
> }
> }
> and the error in my computer is
> file.h': No such file or directory
Just use the C++ file streams. You already included <fstream>,
so you might as well use that instead. No need for "FILE*"
or "fopen()".
Sample file-reading code in C++ (rough outline, untested):
// (Opens a file in binary mode and reads it into a buffer.)
// (Assumes less than ten thousand bytes in file.)
static unsigned char Buffer[10000] = {0};
int index = 0;
std::ifstream FileHandle ("FileName", std::ios_base::binary);
while (!FileHandle.eof())
{
FileHandle.get(Buffer[index]);
++index;
}
FileHandle.close();
> I dont know why this all error
Porting non-portable code. If you really must use some
pre-existing code you found somewhere, try to find something
portable. (Tip: look for code which #include's no headers
other than the std C and C++ library headers.)
> may be my setup this program
Nope.
> Can anyone help me to make speech processing
Yes. Either find portable code, or roll your own.
Hope that helps.
> Thanks alot
You're welcome.
--
Cheers,
Robbie Hatley
lone wolf aatt well dott com
www dott well dott comm slant user slant lonewolf slant