From: Bill Cunningham on
I have this C++ code and I was wondering if anyone has any ideas on how
I might change this to C.

/* chunks.cpp
*
* List the majors chunks of a RIFF file
*
*/
#include <stdio.h>

typedef unsigned char BYTE;
typedef unsigned int DWORD;

int GetLong(char *buf);
void show_list(FILE *in, int length);

int depth = 0;

void indent()
{
int i;
for (i=0; i<depth; i++) printf(" ");
}

class FourCC
{
public:
DWORD code;
int read(FILE *in);
bool Equals(char *str) { return (*(DWORD *)str == code); }
void show();
};

class Chunk
{
public:
FourCC type;
DWORD length;
int read(FILE *in);
void show();
void skip(FILE *in);
bool Equals(char *str) { return (*(DWORD *)str == type.code); }
};

struct Chunk
{
} // instead of a class callled chunck with members?

Bill


From: Bill Cunningham on
Ok here is what I really want to do. I now have found RIFF and AVI
format info in C. How would I go about writing something that would convery
an .avi file to RIFF?

Some simple task :( Not for me yet.

Bill


From: Alf P. Steinbach on
* Bill Cunningham:
> Ok here is what I really want to do. I now have found RIFF and AVI
> format info in C. How would I go about writing something that would convery
> an .avi file to RIFF?
>
> Some simple task :( Not for me yet.

What exactly do you mean?

Maybe I remember wrong but as I recall RIFF is a kind of generic format, where
AVI is one common implementation.

And if that's right then it doesn't make sense to convert AVI to RIFF, since
then it is already RIFF?


Cheers,

- Alf
From: osmium on
"Bill Cunningham" wrote:

> I have this C++ code and I was wondering if anyone has any ideas on how
> I might change this to C.
>
> /* chunks.cpp
> *
> * List the majors chunks of a RIFF file
> *
> */
> #include <stdio.h>
>
> typedef unsigned char BYTE;
> typedef unsigned int DWORD;
>
> int GetLong(char *buf);
> void show_list(FILE *in, int length);
>
> int depth = 0;
>
> void indent()
> {
> int i;
> for (i=0; i<depth; i++) printf(" ");
> }
>
> class FourCC
> {
> public:
> DWORD code;
> int read(FILE *in);
> bool Equals(char *str) { return (*(DWORD *)str == code); }
> void show();
> };
>
> class Chunk
> {
> public:
> FourCC type;
> DWORD length;
> int read(FILE *in);
> void show();
> void skip(FILE *in);
> bool Equals(char *str) { return (*(DWORD *)str == type.code); }
> };
>
> struct Chunk
> {
> } // instead of a class callled chunck with members?

Each member function of a class has automatic access to each variable of
that class *object*. That is, in Chunk, Equals can "see" (and change) the
value of type and length. You current problem, as a wild guess, will only
have one object of type Chunk.

I think for the amount of energy expended by you, your time would be better
spent learning C++, rather than learning to convert to another language.
There are whole books on the subject of learning C++, AFAIK not a single
book on how ro convert C++ to C. Isn't that a good enoguh reason by itself?


From: Bill Cunningham on

"osmium" <r124c4u102(a)comcast.net> wrote in message
news:7uq3h3F3n8U1(a)mid.individual.net...

> I think for the amount of energy expended by you, your time would be
> better spent learning C++, rather than learning to convert to another
> language. There are whole books on the subject of learning C++, AFAIK not
> a single book on how ro convert C++ to C. Isn't that a good enoguh reason
> by itself?

I am trying to learn std C, algebra, and encryption. I might have to
much on my plate and need to just learn C by studying my little books on C
and kandr2. I'm straining myself I think.

Bill