|
You have a pointer named pNum. That can be used with the '->' operator, and also the indexing operator '[]'.
Either of pNum->make or pNum[0].make refer to the same object.
When you use the index operation, you don't have a pointer any more, you have an indexed instance of the thing the pointer points to.
So you can say:
pNum[i].make
or even
&pNum[i]->make
but the latter is just perverse
Hope this helps, and welcome to the wonderful world of C++
Steve S
Developer for hire
|
|
|
|
|
Steve S wrote:
&pNum[i]->make
but the latter is just perverse
or (pNum + i)->make ?!
TOXCCT >>> GEII power
|
|
|
|
|
This is a student project, not the obfiscated C++ coding contest. Any student who turns in either of those two perverse options had better have a good explination as to why they did that, and not the simple pNum[i].make! Otherwise they will lose points.
I'm sure there is a good reason to use either of those forms. I can't think of one offhand though.
|
|
|
|
|
yes, of course, but we're also here to share knowledges...
TOXCCT >>> GEII power
|
|
|
|
|
Sick people . . . teaching pointer arithmetic to beginners.
The question "Do computers think?" is the same as "Can submarines swim?"
|
|
|
|
|
|
Hi
I am working in a program that needs to store some data in a database, but this database must be encrypted. Using Access mdb files is not an option, because programs like "Access Password" find file's password in no time.
So I need a database system that can read files from memory buffer and make queries on its data. Any hint about this problem?
Thank you
|
|
|
|
|
How much data is involved, and why does it have to be a database?
Could you not use a simple binary file, and use a strong encryption technique yourself?
As I understand it, encrypting an Access database causes each 'page' to be encrypted using a block cipher (RC4?), but the same key is used for each page. I'd be happy to be corrected if I'm wrong.
Steve S
Developer for hire
|
|
|
|
|
Hi, thanks for answering
Yes, this is the very same that I told my boss: "Why not use encrypted XML files?"
He wants to use SQL queries, because data requeriments could grow sometime in future
All I need is a library that can get the database from a memory buffer and execute SQL queries on database's data.
|
|
|
|
|
You need a database that supports encryption of stored data.
You *could* use SQLite, and modify the pager functions so that they encrypt before writing and decrypt after reading, which would give you roughly what you want. Is the app going to have 'exclusive' access to the database?
Steve S
Developer for hire
|
|
|
|
|
Hi again
I don't know why SQLite works. I need that database file would not be exposed ever. Does your solution contemplate this feature? Here in my job I heard suggestions like "encrypt mdb file, and to load it desencrypt to a temporal file and load from this file... and later delete it" Not a viable solution, isn't it?
Well, I'll look more on SQLite. Thanks again
|
|
|
|
|
If you change the sections of SQLite that do disk I/O so that they encrypt before writing and decrypt after reading, the db isn't exposed except via that version of SQLite. It's similar to what you've had suggested, but the functionality is built into the database itself.
Depending on the encryption method, it could slow things down a bit, but it should be more secure.
Using temporary files is definitely not a viable solution for security
Steve S
Developer for hire
|
|
|
|
|
Before we start, have you read "Applied Cryptography" By Bruce Schneier? If not you and your boss need to stop everything and start reading. Cryptography is very subtile, there are many places to make a mistake that allows an attacker to get your data, without you knowing! Check out his other books too.
Did you try google? I quickly found this link to a company that claims to do what you want. (maybe, I don't know your requirement)
http://www.netlib.com/
My favorite databse, postgresql, has some encryption modules. Access is a toy database, though it might work I would not reccomend it for anything important.
http://www.postgresql.org/
My google search also found links to many other databases, and I didn't spend much time on it.
|
|
|
|
|
Gammenon wrote:
...but this database must be encrypted.
Why?
Gammenon wrote:
Using Access mdb files is not an option, because programs like "Access Password" find file's password in no time.
Who will have access to the database outside of your application?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi!
Database files must be encrypted, because we don't want that anybody can see what is inside. And these files will be visible, perhaps in the application's folder.
|
|
|
|
|
Gammenon wrote:
Database files must be encrypted, because we don't want that anybody can see what is inside.
I know what encryption is for. I was trying to ascertain your particular need. You can protect the file at the OS level, guaranteeing that unauthorized users/groups cannot access the file. On top of that, both Microsoft SQL and Access have internal security. I'm not seeing a need to complicate matters with encryption.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I've been trying to create an BMP file, with information generated by Pixel Font Maker[^]
Now this program generated a file with 128 char arrays, where each array is a charactor in the fontset.
What i would love to be able to do, is convert this file into a bitmap of all those fonts, and for this i'll need a bit of help. Like where to begin, if there are classes i can use that has the 'saving' feature buildin and so forth.
I use MFC and VC++6.
Here is a sample of the output of the letter 'A' from pixel font maker
const unsigned char uc2_0041[] = {<br />
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x00,0x0c,0x00,0x12,0x00,0x12,0x00,0x12,0x00,0x3f,0x00,0x21,0x00,0x40,0x80,0xe1,0xc0,0x00,0x00,0x00,0x00}
The programs syntax is explained here[^]
Hoping for some help..
PS: I've totally new to this kind of programming, so please don't assume i know anything specific.. Thanks again.
|
|
|
|
|
I think you can use fwrite to write the color of each pixel.
Search some on the structure of a bitmap.
there are two parts:
- a heading containing some info (don't know which by heart)
- RGB of each pixel (but bakwards written so BGR!!)
that's about it what I remember of it, but maybe it will get you started.
good luck.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
hi,
anyone know how to define a script variable in Visual Studio for path setting in Project Properties page?
i can see library path setting like this:
$(PUBLIC_PATH)\debug\userapi.lib
how can i define such $(PUBLIC_PATH) by myself?
any help?
thanks,
jim
|
|
|
|
|
I just defined one last night for wxWindows wxWidgets.
Here's what I did...
1) In Windows XP, right-click My Computer, click Properties.
2) Click the Advanced tab.
3) Click Environment Variables.
4) Add your PUBLIC_PATH variable. (you should see the Visual Studio paths in there)
It didn't take effect right away for me - I'm not sure if just shutting down VS will get it to work, or a reboot is required. I rebooted (I needed food anyways) and it worked fine.
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
Hi all ,
I have an SDI application in which i have created a dialog box and attached that to frame and on the dialog box I kept few buttons which r owner drawn and all the buttons are members of dialog class and are made as objects of button class,now when ever i click the button on the dialog box keyboard messages should be generated and that character should be sent to the edit view by using the following code they r displaying but giving problem when i keep cursor on them and try to type with keyboard keys
void MyDialog::OnButton65()
{
CTrailView *pView = (CTrailView *)((CMainFrame*)GetParent())->GetActiveView();
BYTE keyState[256]={0};
GetKeyboardState((LPBYTE)&keyState);
short shift=0;
shift =GetKeyState(16);
short caps=GetKeyState(20);
if(caps)//shift)
{
pView->SendMessage(WM_KEYDOWN, 65, 1);///for 'A'
pView->SendMessage(WM_CHAR,65,1);
pView->SendMessage(WM_KEYUP, 65, 1);
}
if(!caps) //!Shift)
{
pView->SendMessage(WM_KEYDOWN, 97, 1);///for 'a'
pView->SendMessage(WM_CHAR,97,1);
pView->SendMessage(WM_KEYUP, 97, 1);
}
}
the reason is my 2nd and 3rd parameters of SendMessage are not correct can any one tell me how can I send proper wparam and lparam values there so that I can proper out put and which API's gives me those values
Request to all to continue this
|
|
|
|
|
Hi,
i am using a listbox with several entries. At runtime I wanna delete an entry without losing the others indizes. The reason is: I am using an array of a structure, and every entry has its own structure. But, if I delete an entry, lets say, at the beginning, all others will change their index. This way I cant use this index as number for the structure array. I tried to do a little workaround with SetItemData, but thats some kinda too complicated.
What can I do? Did I miss anything?
One more thing, which may solve the problem too: How can i change the text of a Listbox item? I used to delete the item and insert it again,but that causes the same problems with indexing as mentioned above!
DKT
|
|
|
|
|
When deleting an item in listbox why don't you delete the corresponding array item (ie, update you array ) also.
There is no spoon.
suhredayan
|
|
|
|
|
Cause, if I delete the corresponding array item, all others will keep their index for the array, not like the listbox. If it would change its index just like the listbox does, there wouldnt be any problem! And I dont think that you can simply change the indizes of a structure array! Correct me if I am wrong.
DKT
|
|
|
|
|
Yes, you have to take the pain of removing the corresponding structure from the array and shift all the below structures up and update the array count variable.
MFC provide collection class to do this for you CArray, CMap etc.
A better solution will be to use CMap and map the structure with the listbox text. But for this to work nicely there should be no repetations in listbox contents.
There is no spoon.
suhredayan
|
|
|
|
|