|
no way... this kind of database doesn't support your wishes!
better try ms sql or mysql
Don't try it, just do it!
|
|
|
|
|
I just went through this same problem with an app I am developing. The drivers for Access do not allow remote connections. I had to export my Access database and import it into MySQL and the ODBC driver for MySQL allows you to specify a URL for the server and the database name on the server.
I'm going to live forever or die trying!
|
|
|
|
|
I can define an array in my local variables (to a certain function), but I am having trouble defining that array as a global array that I could use in all of my subfunctions.
Here is how I define the variable in my local area (this works)
<br />
void CMyDialog::OnMyFuntion()
{<br />
<br />
double f1, m_div;
double ValuesArray[200];
<br />
ifstream inf; <br />
inf.open("Testdata1tab.txt");
<br />
for (int i=0; i < 199; i++)
{<br />
inf >> f1;
ValuesArray[i] = f1;
<br />
Value = ValuesArray[i]/m_div;
}<br />
<br />
inf.close();<br />
}<br />
}<br />
When I try to define the array in my .h file as a public variable, I get a runtime error. Here is how I try to define the array:
<br />
class CMyDialog : public CDialog<br />
{<br />
public:<br />
CMyDialog(CWnd* pParent = NULL);
enum { IDD = IDD_MY_DIALOG };<br />
double ValuesArray[200];<br />
I leave the .cpp file at the top the same, except that I remove the double ValuesArray[200]; line.
I am probaly doing several things wrong. Any help will be more than welcome.
I wish I could type better ...
|
|
|
|
|
spaced_out wrote:
I get a runtime error.
That sounds like visual basic to me... You mean exception? Which one Access Violation or Division by zero??
John
|
|
|
|
|
Sorry about that, is says I have an illegal operation. (too many different languages to keep up with.)
I am putting the read in values into a List Control. The scroll bar appears when I execute, but then it just stops before I see the data?
Here is the error message:
MYSOURCE caused an invalid page fault in<br />
module MSVCRT.DLL at 0167:7800a796.<br />
Registers:<br />
EAX=5f4b64b0 CS=0167 EIP=7800a796 EFLGS=00210246<br />
EBX=0063f600 SS=016f ESP=00540000 EBP=00540020<br />
ECX=005400a4 DS=016f ESI=817ce080 FS=5b67<br />
EDX=bff76855 ES=016f EDI=005400cc GS=0000<br />
Bytes at CS:EIP:<br />
55 8b ec 83 ec 04 53 56 57 fc 89 45 fc 33 c0 50 <br />
Stack dump:<br />
bff76849 005400cc 0063f600 005400e8 005400a4 005401d8 bff76855 0063f600 005400b4 bff87fe9 005400cc 0063f600 005400e8 005400a4 5f493801 00540290
I wish I could type better ...
|
|
|
|
|
Are you 100% sure that you are not stepping past the end of the array? Using an invalid index < 0 or > 199..
John
|
|
|
|
|
Good call. I don't know how I was doing it, but that change let me run the code. Unfortunately, after exit the dialog I get a new error message. I guess it works up to that point and that is something.
THanks. Helpful comments.
I wish I could type better ...
|
|
|
|
|
What error message do you get?
My first thoughts would be to move the declaration to outside of the ClassWizard generated code
class CMyDialog : public CDialog
{
public:
CMyDialog(CWnd* pParent = NULL);
enum { IDD = IDD_MY_DIALOG };
double ValuesArray[200];
};
Michael
'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879
|
|
|
|
|
I moved it outside, but I still get an error (once the code is done running). It works up until that point. Thanks to me changing the size of the array. I swear I had it set up correct, but I guess not.
This is the error message I get when I do it inside the ClassWizard zone
MYSOURCE caused an invalid page fault in<br />
module MSVCRT.DLL at 0167:78009dd3.<br />
Registers:<br />
EAX=00000000 CS=0167 EIP=78009dd3 EFLGS=00210246<br />
EBX=0063f600 SS=016f ESP=00540000 EBP=00540034<br />
ECX=005400dc DS=016f ESI=817f7600 FS=20d7<br />
EDX=bff76855 ES=016f EDI=00540104 GS=0000<br />
Bytes at CS:EIP:<br />
55 8b ec 56 8b 75 18 57 bf 20 05 93 19 39 3e 74 <br />
Stack dump:<br />
7800a7bc 00540104 0063f600 00540120 005400dc 5f4b5948 00000000 00000000 00000000 00540104 817f7600 0063f600 5f4b5948 00540058 bff76849 00540104
This is what I get if I am outside the Class Wizard stuff:
MYSOURCE caused an invalid page fault in<br />
module MSVCRT.DLL at 0167:78009dd3.<br />
Registers:<br />
EAX=00000000 CS=0167 EIP=78009dd3 EFLGS=00210246<br />
EBX=0063f600 SS=016f ESP=00540000 EBP=00540034<br />
ECX=005400dc DS=016f ESI=817f7c40 FS=3227<br />
EDX=bff76855 ES=016f EDI=00540104 GS=0000<br />
Bytes at CS:EIP:<br />
55 8b ec 56 8b 75 18 57 bf 20 05 93 19 39 3e 74 <br />
Stack dump:<br />
7800a7bc 00540104 0063f600 00540120 005400dc 5f4b5948 00000000 00000000 00000000 00540104 817f7c40 0063f600 5f4b5948 00540058 bff76849 00540104
Keeping in ming that if I define the array inside of the subroutine-locally (or function? I don't know the right word.) I get no error at all???
I wish I could type better ...
|
|
|
|
|
spaced_out wrote:
for (int i=0; i < 199; i++) // loop 200 times for 200 lines of data
FYI, this only loops 199 (0-198) times. That's not the issue at hand, though.
When you are read from the ValuesArray[] array, adding the values to the list control, what line of code causes the error? Is it an access violation, or a fired assertion?
|
|
|
|
|
Thanks for the 0-198 clarification.
The error is posted in my reply above. I have NO IDEA what it means?
I wish I could type better ...
|
|
|
|
|
hehe, i'm sure it is a stack overflow... because of page fault...
you define the CDialog class local in the InitInstance function of the program, right??
then it makes no difference, if you place the whole class in stack or just the 200 doubles.
define the CDialog class GLOBAL, then it should work!
Don't try it, just do it!
|
|
|
|
|
200 doubles is not a lot of memory.
John
|
|
|
|
|
Do you have another way for me to define these numbers that would take up less space?
Instead of double?
If so let me know.
I wish I could type better ...
|
|
|
|
|
My point is that 200 doubles only takes 800 bytes of memory. Your stack is over a megabyte. So the memory allocation is insignifigant... I have programs that allocate over a gigabyte of data with no probelem. They do not put it on the stack though....
John
|
|
|
|
|
next time better take a calculator!
200*sizeof(double)=200*8=1600bytes!
Don't try it, just do it!
|
|
|
|
|
You are correct a double is 8 bytes... Anyways 1600 bytes on the stack is still not signifigant..
John
|
|
|
|
|
Alexander M,
I didn't understand what the Hell you were talking about (well maybe just a little), but it got me thinking and tried some new stuff. I just defined the array in the .cpp soure code outside of all subroutines(functions? I still don't know what to call it.) And POW, BINGO, YEEHA, WHOOPIE GOLDBERG, HOORAY! It works. Global array, and no errors!
I don't know if that is what you were trying to tell me, but we will just say it was. SO, I gave you a 5 out of 5 for helpfulness, but I would have given you a 10 if they let me.
You da bomb.
Thanks!
I wish I could type better ...
|
|
|
|
|
I am not sure that it is fixed. I think you just delayed the crash by moving the variable to a different memory location.
John
|
|
|
|
|
|
thx
Don't try it, just do it!
|
|
|
|
|
I think the only reason why that solved your problem is that if you step past the end of a global variable you are probably not going to interfere with the runtime stack. Your problem probably still exists but in a sneaky way. Try the following declare your values array as
double ValuesArray[190];
Guess what it probably will not crash your dialog this time either. Why does it not crash the dialog? It is overwriting other variables in your global data that could come back and cause your program to work in an unexpected way.
I just tested my theory and it worked. I created a dialog application and in my OnOk() function I did the following which caused a crash because I am stepping past the end of ValuesArray.
void CStackOverflowDlg::OnOK()
{
double ValuesArray[200];
for(int i=0;i < 300;i++) {
ValuesArray[i] = 100.0;
}
}
Guess what moving ValuesArray to the global namespace and there was no crash at all.
double ValuesArray[200];
void CStackOverflowDlg::OnOK()
{
for(int i=0;i < 300;i++) {
ValuesArray[i] = 100.0;
}
}
But have I fixed the problem? Absolutely NOT! I still am using more items ValuesArray than I declared...
John
|
|
|
|
|
Hi,
How to assign a new IP address through MFC for windows 98. after assigning
I should not restart the system and could be able to continue with
communication. I tried with AddIPAddress().
but this supports only winNT. Is there any equivalent api in windows 98.
thanks in advance,
pramod.
Pramod Kumar A
SASKEN-INDIA
|
|
|
|
|
Interesting. One possible solution is to change the IP via registry.
Kuphryn
|
|
|
|
|
Is there such a thing? In short, I need to hook a game that was written with DirectX...
Thanks
Ralph Krausse
|
|
|
|