|
Thanks!I'll have a try!
...always look on the <blink>bright
side of life...
(Whistle)
|
|
|
|
|
Hi Yulianto:
I'm confused!in main()
<br />
int main()<br />
{<br />
link *head = new link;<br />
initialize(head, 10); <br />
print(head); <br />
}<br />
|
|
|
|
|
Well, it's hard to explain. When you enter initialize, it didn't change the address of head in main. You should understand about pointer. Maybe this[^] could help.
<italic>Work hard, Work effectively.
|
|
|
|
|
The head variable is passed to the function by value, which means that it is a copy of what is being passed. Therefore, you can use the variable head any way you want in the called function without changing the original variable in main.
Example:
void myFunc(int i)
{
i = 25;
}
int main()
{
int i = 0;
myFunc(i);
return(0);
}
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
How about something like:
struct link
{
link(){}
link( const int n)
{
a = n;
next = NULL;
}
int a;
link *next;
};
struct link *first = NULL;
struct link *last = NULL;
void addhead( struct link *newlink )
{
if (NULL == last)
last = newlink;
if (NULL != first)
newlink->next = first;
first = newlink;
}
void addhead( const int num )
{
struct link *newlink = new struct link(num);
addhead(newlink);
}
void addtail( struct link *newlink )
{
if (NULL == first)
first = newlink;
if (last != NULL)
last->next = newlink;
last = newlink;
}
void addtail( const int num )
{
struct link *newlink = new struct link(num);
addtail(newlink);
}
void main( void )
{
struct link *list;
for (int x = 0; x < 10; x++)
addtail(new struct link(x));
addtail(15);
addhead(2);
addtail(288);
list = first;
while (NULL != list)
{
cout << list->a << endl;
list = list->next;
}
}
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Thanks!I'll have a try!
...always look on the <blink>bright
side of life...
(Whistle)
|
|
|
|
|
i want to embed a tiff file in a pdf.can i use opi and ef entries?
|
|
|
|
|
i used WIN32_FIND_DATA to find the folder and file in any directory .it is showing the correct result.but not in case of Program files.it is showing me Program files as file
|
|
|
|
|
i think it is the problem of folder's name(Program files).
|
|
|
|
|
sunit5 wrote:
it is showing
What is "it?" You'll need to show us a code snippet if you want any reasonable help.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi,
I am hosting a webview control. My application has a list of safe files and applications that exist on the user's intranet or local filesystem. Is it possible to skip the file download dialog prompt that the IE control brings up to open these? I have been searching the msdn site without much luck. I tried implementing ProcessUrlAction for the internet security manager, but it doesn't seem to get called before the prompt.
Any help is appreciated!
|
|
|
|
|
I just developed a program which runs from an USB disk, and when I gave it to my client, he got a strange problem with a .dll file missing error..just check out the screenshot..
here[^]
what .dll file is that ? thats not wsock32.dll....there's a sign inside it..like the male/female sign...never heard of this .dll file before
I think his USB disk is corrupted...coz a minute ago he coudn't copy files to it...and it made the pc hang..and then he formatted and the copy started working
I am not really expecting too much from this post..but well...has anybody run into the same problem?
kane
"Some guys hack just to get themselves a girlfriend.What a pathetic reason huh ?"
|
|
|
|
|
I think you;ve answered your own question
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
hi all!!
i am facing a problem i am bnot able to understand!!!
consider the foll codes in my project
CPrjView pview;
long c1=pview.ctr;
these r lines written in a c.cpp
and it includes the PrjView.h file
ctr is a public variable of The CPrjView class of type long
i am not underrstanding that why c1 is getting a very strange value!!!
for ef ctr is 3 and still c1 is getiing a value like -85899346
also i am not able ti change the values of variables in this c.cpp
for eg if i write
pview.ctitle="ABC";
ctitle is a public variable of CPrjView class of type CString it is giving a run time error...
please help!!!1
|
|
|
|
|
doing CPrjView pview; calls the default constructor CPrjView::CPrjView() .
be sure you're correctly initializing ctr into this constructor, because it seems to be nowhere else getting a value...
maybe you think it contains 3, but it doesn't. did you use the debugger ?
what happens if you do the following ?
pview.ctr = 3;
long c1 = pview.ctr;
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
thanks a lot!!!!!!!!!!1
it solved my prob....i need practice!!!!!!
thanks
but can u also advice me something
i wan t to permanently save the changes made in an array of strings.....
i tried to use databse for it but cud not...do u know hot to get data from multiple tables in different variables
thanks again
|
|
|
|
|
what database do you use exactly ? if MS SQL Server, ADO is the best way (i consider you know about SQL though - see Carlos Antollini's ADO Classes[^] for that).
if you use simple files, it will depend on how you format them...
cheers,
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
i am using access datase linking by odbc....
is ado better???or it is possible to do so in odbs using access database
acually the thing is i am already using a database for retrieving data in a form in this same project....
i now want to use another table in the same database for retriving data in to another form
plz help or suggest a diff way
thanks
|
|
|
|
|
sorry, i don't know at all how to use access DB...
you should ask this in a separate thread...
(search also on codeproject && google ; there are certainly many useful articles on the subject)...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hi,
U can use CDaoDatabase and CDaoRecordset Classes to handle databases. U can directly open access(.mdb) databases and also thro odbc. These classes support both of them. U can also ADO. it is better than DAO. Refer MSDN for more details.
Bye
Cool Ju
|
|
|
|
|
thanks a lot
it solved my prob thanks again!!!
but can u tell me another thing
plz suggest me a medthod to permanently save the changes made during run time into a array of strings in vc++
i tried to use database but am unable as i am already using a database to get data into a form in the same project
do u know how to get data from multiple tables in the same project into diff forms...
thanks again
|
|
|
|
|
smartymanav wrote:
for ef ctr is 3 and still c1 is getiing a value like -85899346
Never define a variable anywhere without giving it a default value. Otherwise, this is what you get. I think the other response covers your more specific problem.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
How to get such a kind of operator= overloading that given a class instance we will be able to do this
class Test
{
int m_data[10][10];
public:
void operator=(int x);
};
Test tst;
tst(2,3) = 20; //and that 20 number will be put to m_data[2][3] ?
9ine
|
|
|
|
|
You can't, at least I don't think so.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
i don't understand you're problem...
you want to overload the operator=() for your class Test ?
nop, it's not actually what you want. here, you need an operator=() that returns an int . right ?
but what you can't do is reaching the (2,3) cell in your array.
so, you have to overload the operator()() ...
<font color=blue>class</font> Test {
<font color=blue>int</font> m_data[10][10];
<font color=blue>public</font>:
Test();
<font color=blue>virtual </font>~Test();
<font color=blue>void operator</font>=(<font color=blue>int</font>); <font color=green>
<font color=blue>int</font>& <font color=blue>operator</font>()(<font color=blue>int</font> x, <font color=blue>int</font> y);
};
<font color=blue>int</font>& Test::<font color=blue>operator</font>()(<font color=blue>int</font> x, <font color=blue>int</font> y) {
<font color=green>
<font color=blue>if</font> (x < 0) x = 0;
<font color=blue>if</font> (y < 0) y = 0;
<font color=blue>if</font> (x > 10) x = 10;
<font color=blue>if</font> (y < 10) y = 10;
<font color=green>
<font color=blue>int</font>& ri = m_data[x][y];
<font color=blue>return</font> ri;
}
this way, when you do:
Test tst;
tst(2, 3) <font color=green>
= 20; <font color=green>
ASSERT(tst(2,3) == 20);
Test *pTst = &tst; <font color=green>
(*pTst)(2, 3) = 21; <font color=green>
ASSERT(tst(2,3) == 21);
cheers,
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|