From: JoeC on
How do I create a resource from either a binary fine or a text file.
I have programs where load in text or binary information but I would
like to load them as resources.

EX:
for(int lp = 0; lp != end; lp++){
f.read((char*)&bitData[lp], sizeof(BYTE));
}

or:
ifstream f ("table.txt");
if (! f.is_open()){
MessageBox(NULL, "Can't Load the Table!", "Error!", MB_OK); }

for(int l2 = 0; l2 != 8; l2++){
for(int l1 = 0; l1 != 8; l1++){
if(cfill(f, num)){
t[l2][l1] = num;
}
}
}
f.close();
From: Dean Earley on
JoeC wrote:
> How do I create a resource from either a binary fine or a text file.
> I have programs where load in text or binary information but I would
> like to load them as resources.
>
> EX:
> for(int lp = 0; lp != end; lp++){
> f.read((char*)&bitData[lp], sizeof(BYTE));
> }
>
> or:
> ifstream f ("table.txt");
> if (! f.is_open()){
> MessageBox(NULL, "Can't Load the Table!", "Error!", MB_OK); }
>
> for(int l2 = 0; l2 != 8; l2++){
> for(int l1 = 0; l1 != 8; l1++){
> if(cfill(f, num)){
> t[l2][l1] = num;
> }
> }
> }
> f.close();

I don't know the details of the rc file structure, but you can add
entries that import a file when it is compiled.

You can then use FindResource and friends to access the data at runtime.

--
Dean Earley (dean.earley(a)icode.co.uk)
i-Catcher Development Team

iCode Systems
From: Grzegorz Wróbel on
JoeC wrote:
> How do I create a resource from either a binary fine or a text file.
>

If your IDE doesn't manage this for you, and you need to edit rc file
manually it's something like:

IDR_BIN1 BINARY DISCARDABLE "file.bin"


(you need to define IDR_BIN1 somewhere, usually in resource.h file)

--
Grzegorz Wr�bel
677265676F727940346E6575726F6E732E636F6D
From: JoeC on
On Jul 4, 5:08 am, Grzegorz Wróbel </dev/n...(a)localhost.localdomain>
wrote:
> JoeC wrote:
> > How do I create a resource from either a binary fine or a text file.
>
> If your IDE doesn't manage this for you, and you need to edit rc file
> manually it's something like:
>
> IDR_BIN1 BINARY DISCARDABLE "file.bin"
>
> (you need to define IDR_BIN1 somewhere, usually in resource.h file)
>
> --
> Grzegorz Wróbel
> 677265676F727940346E6575726F6E732E636F6D

point = new graphic(IDR_BINTYPE, hinstance);

Thanks, I had tried that but it says my IDR_BINTYPE has not been
defined in this section and it is in my main function and had to put
this above the statement for it to compile:

#define IDR_BINTYPE 500
From: JoeC on
On Jul 4, 5:08 am, Grzegorz Wróbel </dev/n...(a)localhost.localdomain>
wrote:
> JoeC wrote:
> > How do I create a resource from either a binary fine or a text file.
>
> If your IDE doesn't manage this for you, and you need to edit rc file
> manually it's something like:
>
> IDR_BIN1 BINARY DISCARDABLE "file.bin"
>
> (you need to define IDR_BIN1 somewhere, usually in resource.h file)
>
> --
> Grzegorz Wróbel
> 677265676F727940346E6575726F6E732E636F6D

Thanks, I have been working with this code for a while, I think I have
the internals working fine but still a BINARY type is not working. I
am using DEV C++ and it does not recognize BINARY.

When I use:
#define IDR_BIN 500
IDR_BIN BINARY DISCARDABLE "pointer.bin"

Do I have to define something special for BINARY? If I do I can't
find the resources to do that. I can load and save from a binary file
but loading as a resource is getting fustrating.

It won't seem to load in the Binary data to IDR_BIN