|
<a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/sysinfo_08f9.asp">GetComputerName</a>
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
Hi,
Pls help..I got the DSN names by using SQLDataSources().
How is it possible to connect to a particular DSN .
|
|
|
|
|
SQLConnect()
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
also:
SQLDriverConnect
Mazy
Don't Marry a Person You Can Live With...
Marry Someone You Can Not Live Without
|
|
|
|
|
Hi,
Pls help..I got the DSN names by using SQLDataSources().
|
|
|
|
|
my program runs almost fine, when i compile there are no errors.
but if i wrie one special line of code, the whole program crashes
if you want to tell me how to fix it
i will send you the code or whatever you want me to do, but i cannot post it here.
Thank you.
|
|
|
|
|
What does the program do? And what is the special line which causes a crash? What is the error it shows when it crashes?
Atul
<marquee bgcolor="yellow" direction="LEFT" behavior="SCROLL" scrolldelay="250" scrollamount="5">
Sonork ID : 100.13714
|
|
|
|
|
position = tempInvestors->binarySearch(tempInvestors->getInvestorsList(),0,9,tempSS);
*tempInvestor = tempInvestors->getInvestor(position);
tempAB = tempInvestor->getAccountBalance(); //AccountBalance Of Buyer
// Here i'm performing another binary search to look for the
// specific stock that has that same stockTicker
position = tempStocks->binarySearch(tempStocks->getMyStocks() , 0, 14, tempST);
*tempStock = tempStocks->getStock(position);//THIS LINE IS THE ERRONEOUS ONE
tempIV = tempStock->getInitialValue(); // storing the stockprice in tempStockPrice
//ok I have the same piece of code in another method and i copied just the way it is, but it works fine without if you comment ou that line only in the second method??
it never crashes if i keep it in the first method only.
Thanks
|
|
|
|
|
position = tempInvestors->binarySearch(tempInvestors->getInvestorsList(),0,9,tempSS);
*tempInvestor = tempInvestors->getInvestor(position);
tempAB = tempInvestor->getAccountBalance();
position = tempStocks->binarySearch(tempStocks->getMyStocks() , 0, 14, tempST);
*tempStock = tempStocks->getStock(position);
tempIV = tempStock->getInitialValue();
Do you mean that the above code when pasted into another member function causes the crash? What is the error message?
Atul
Sonork ID : 100.13714
|
|
|
|
|
can i send you the code?
i mean to your email!
|
|
|
|
|
Good boy, Marwan!
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
LOL
:) Good boy, Marwan!
Nish :)
You can send it but before that do two things (It may save you the burden of
sending...)
1) What is the error seen?
2) Debug your code
Below is a step by step process. I assume you are using Visual Studio (MS
VC++ IDE).
a)Open your project in the VC++ editor.
<HR></HR>
b) Go to the file in which you have pasted the second piece of offending code
i.e. this
position = tempInvestors->binarySearch(tempInvestors->getInvestorsList
(),0,9,tempSS);*tempInvestor = tempInvestors->getInvestor(position);tempAB =
tempInvestor->getAccountBalance();
performing another binary search to look for the
that same stockTickerposition = tempStocks->binarySearch(tempStocks-
>getMyStocks() , 0, 14, tempST);*tempStock = tempStocks->getStock
(position);
();
<HR></HR>
c)Insert a Breakpoint on the first line of your seemingly offensive code. You
do this by right clicking on the far left side of the line where you see the
grey (grey color is the default) band (column). You will get a drop down list
from which you select the first "Insert / Remove Breakpoint". Once it is
clicked you will see a nice round filled (maroon by def) bullet in the column.
<HR></HR>
d)Make sure that you are building in debug mode.
<HR></HR>
e)Now press "F5" to start your debug session. You will go to VC++ IDE Debug
mode and if your app has an GUI / console interface you will see it.
Depending on whether this piece of offensive code (hereby referred to as OC)
is called or you have to i/p something for it to be called you will either be
seeing the OC with an arrow in the debugger(i.e. your proggie has been
stopped there so that you can check the parameter values) or you will land in
your program.:omg:
<HR></HR>
f)If you land in your proggie while it's waitin for your i/p then i/p
something so that the OC line 1 is called.
<HR></HR>
g)Now if you see the arrow (yellow by def) use the following key to execute
your program step by step.
"F10" to step over OC line num one
"F11" to step into the "binarysearch" member function after which you can use "F10"
<HR></HR>
h)Remember that whichever key you press watch for the consequences down in
the Auto Watch variables window in which you will see your relevant auto variables. To check any other variables, Type them(name) in the
Watchn window. After every step you execute of your proggie check for
any logic,pointer discrepancies.
<HR></HR>
i)If while this stepping your proggie crashes you will nail the OC. If luck
favors you it will be that same line otherwise check a few lines of code
before that OC line.
<HR></HR>
j)If you want to stop debugging press Shift+F5
Whew hope I make sense.
Atul
Sonork ID : 100.13714 netdiva
|
|
|
|
|
every thing you said really makes sense, but in point f
f)If you land in your proggie while it's waitin for your i/p then i/p something so that the OC line 1 is called.
here I have a file that i want to give to the program, i don't want to do it manually coz it is a long file.
do you know how do i make it read from that input file, instead of waiting for me to input the data from the keyboard?
thanks
appreciate your efforts to answer my question.
|
|
|
|
|
It has become abundantly obvious that you need to learn how to debug YOUR OWN code. One of the first things I do in this situation is to expand all code expressions. Break them down to their simplest components and use LOTS of temporary variables so that you can examine each of their values. This may not be the most efficient of methods but that is not a high priority for you at this point in time. I see lots of pointer derefs in your code. Make each of them a temporary variable so that you see what the assignment actually is. Step into each of these function calls so that you see what is actually going on.
This is the only way that you will really learn what your code is doing.
|
|
|
|
|
Hi,
I program using Visual C++, vi, some occassionally using KDevelop. I usually experience problems with tabs and spaces. I use tab (3 spaces) in Visual C++. However, vi almost always open the source files with random spaces.
In general, do developers use spaces instead of tabs?
Thanks,
|
|
|
|
|
kuphryn wrote:
In general, do developers use spaces instead of tabs?
No!!! I don't think any serious developer would use spaces.
By the way if you have saved a file from Visual Studio and it looks funny in vi then you might have to convert it from DOS to UNIX [basically replace every CR LF with CR]
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Actually this is a subject of widespread debate.
My personal MO is to use tabs of four spaces each.
But that's just me.
I also indent the parens but then again, this a matter of style.
My jokes page
|
|
|
|
|
Someone who actually uses the same style as me?
Do you really exist?
Roger Allen
Sonork 100.10016
If I'm not breathing, I'm either dead or holding my breath.
A fool jabbers, while a wise man listens. But is he so wise to listen to the fool?
Please step to the rear of the car and make room for more victims. - John Simmons the Outlaw programmer, 1st Feb 2002, in the lounge
|
|
|
|
|
Chk these
ftp:
ftp:
ftp:
ftp:
ftp:
Atul
Sonork ID : 100.13714
|
|
|
|
|
A tab is 8 spaces in any other editor I know of except VC++. If you need to edit the same code in different editors, set tabs to 8 spaces or use spaces instead of tabs.
|
|
|
|
|
Thanks everyone.
I set Visual C++ to use *spaces* when I hit the tab key. This method works great. Thanks!
Kuphryn
|
|
|
|
|
i have a program where i need to read and save .cur files. I figure saving will be done in the serilize function but i dont know how to actually save the info as the .cur format. i figure its just a bitmap with a point(the hot spot) but im not sure. anyone know of any sites that say how to do this? hope that makes sense.
-Raffi
The truth about C++
|
|
|
|
|
|