|
It is pointer to pointer i.e. int**
|
|
|
|
|
Lao Wang wrote: what is the mean and value of &c?
It is the address of c array. It will be same as &c[0].
Lao Wang wrote: what is the mean of (int*)&c ?
It is only a conversion of pointer from (char*) to (int*)
- NS -
|
|
|
|
|
NS17 wrote: It is only a conversion of pointer from (char*) to (int*)
char* ? or char** ?
|
|
|
|
|
Yes char** is correct.
I mentioned only about the memory adresss.
- NS -
|
|
|
|
|
you already got some good answers, but i'll sum it up.
c is defined as an array of char , so, basically, it can be seen as a char* .
& used as an unary operator means to return the address of the variable attached, so &c is the address of c.
but as c is a char* , its address is a char** .
in front of it, you have a cast operator, which casts the address returned into an int* address
|
|
|
|
|
thanks
as your mean, &c=char** , but the equation char ** c=&c, has compile wrong message with "can not convert from char (*)[4] to char **"
so i think &c != &c[0];
|
|
|
|
|
Lao Wang wrote: so i think &c != &c[0];
how do you test this ?
BTW, c == &(c[0])
but the first element of the array is at the address of the beginning of the array
|
|
|
|
|
Hi all,
I create a database on SQL 2005 Express edition and link it to a C++/MFC application as follows. It wont gives any compile time errors. But at run time, it gives an error. Here are details.
Link the database in OnInitDialog()
here is the code
<br />
BOOL CSRFDBDlg::OnInitDialog()<br />
{<br />
CDatabase srfDB ;<br />
CString srfNAME ;<br />
<br />
srfNAME = "ODBC; DSN=.SQLEXPRESS; UID=sa; PWD=sa123; DATABASE=srfdb.mdf" ;<br />
srfDB.Open(srfNAME) ;<br />
if(srfDB.IsOpen())<br />
{<br />
AfxMessageBox("ok") ;<br />
}<br />
<br />
srfDB.Close() ;<br />
}<br />
Gives the following runtime error
Data source name not found and no default driver specified
Can you guys tell me where I'm going wrong....
I appreciate your help all the time...
Eranga
|
|
|
|
|
have you defined the DSN in control panel>administrative settings>odbc..?
hope you have not.
gud luck.
---------------------------------------------
Suggestion to the members:
prefix your main thread subject with [SOLVED] if it is solved.
chandu.
|
|
|
|
|
Hey, I've done it correctly
I found a nice book there in the library, and according to that book I think it is easy to use SQLOLEDB.1, simply OLEDB connection.
What you think of it. Actually I'm on the right way now. Open the SQL database and write some values to it.
I appreciate your help all the time...
Eranga
|
|
|
|
|
nice that you got your problem solved.
i have practically not used sql with vc++.
so i cannot suggest you any thing in that area.
gud luck.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
Thank you. Let see what can I do for it.....
I appreciate your help all the time...
Eranga
|
|
|
|
|
How do I open a file with spaces (ex. read me.txt). I know this can be done using getline(Input_File, File_Name), I've tried doing that, but with no luck.
Here's my function:
<br />
void TextInfo(void)<br />
{<br />
ifstream Input_File;<br />
string File_Name;<br />
do<br />
{<br />
Input_File.open( GetString( "Enter name of file to read: " ).c_str() );<br />
if ( Input_File )<br />
break;<br />
cout << "Bad file name, try again." << endl;<br />
Input_File.clear();<br />
} while ( true );<br />
<br />
HoldScreen();<br />
}
|
|
|
|
|
It sounds like your issue is really with your GetString() function...
What does it do and how does it work? What does it do with leading and trailing spaces? Or the carriage-return?
Filenames are allowed to have spaces in them.
Are you sure you're in correct directory when attempting to open the file?
What if you put the file in your root folder, and then attempt to open: C:\read me.txt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</A>
|
|
|
|
|
This is my GetString function, I open from root, but it will say: Bad file name, try again. But when I open a file without spaces, its okay.
<br />
string GetString( string Prompt )<br />
{<br />
bool Done = false;<br />
string InputValue;<br />
do<br />
{<br />
cout << Prompt;<br />
cin >> InputValue;<br />
if ( cin )<br />
{<br />
Done = true;<br />
}<br />
else<br />
{<br />
cout << "Bad Input!" << endl;<br />
cin.clear();<br />
cin.ignore(99,'\n');<br />
}<br />
} while ( !Done );<br />
<br />
cin.ignore(99,'\n');<br />
<br />
return InputValue;<br />
}<br />
|
|
|
|
|
VistaXP wrote: cin >> InputValue;
This will stop at the first whitespace character. Use getline() instead.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I think this is the perfect time for you to learn to use the debugger.
You would have found this problem yourself...
And you would have felt very smart to do so.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</A>
|
|
|
|
|
could anybody tell me,
How to i know memory usage and CPU usage of any specific application/Process using VC++ application?
ThankXXXXX.
|
|
|
|
|
|
abhijit bhopale wrote: How to i know memory usage and CPU usage of any specific application/Process using VC++ application?
See here and here.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thank You Hamiod & David
-- modified at 22:30 Wednesday 24th October, 2007
|
|
|
|
|
Hi All,
I am using VC++ MFC Application.
I want to know the typeof my variable at run time, how can I do that? I hope it is possible with the typeof operator, but it gives me error like this identifier not found.So, is it possible with VC++ to use something like typeof operator??
Thanks in Advance.
Ashish Bhatt
|
|
|
|
|
Try to see 'CRuntimeClass' in the MSDN Library. Good luck
|
|
|
|
|
ashishbhatt wrote: I hope it is possible with the typeof operator
Where is that function? Or did u mean typeid() ?
|
|
|
|
|