|
Try rephrasing this... don't understand what you're trying to do. Also, is this your homework? Sounds like it...
|
|
|
|
|
What?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Cary Hill wrote: Use a sentence,...
1. Review the notes from the last three classroom lectures.
2. Read the last chapter of the class text book.
3. Use the method from both of those to solve the problem.
|
|
|
|
|
Bingo!
Sound Advice,
And Recyclable.
You could Add-
corrolary:
if still in the dark, do same for the previous chapters covered in the Class Text Book, An All Course Notes.
If after that you Still do not know how to ask a question, give up coding. You'll Never get there.
Cheers, Some people seem to think that all of us studied under the same curriculum, where given the same projects, so that we recognise their problem in a glance (we all solved the same question 20 years ago fterall), and that we are just petulent, by one of us not just posting our results to them.
I think it very doubtfull, that people who cannot formulate a problem at hand in a meaningful way, will ever become successful in software development.
Regards
Bram van Kampen
|
|
|
|
|
nice advice!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Once I have a long file with ascii text- long row of numbers. I used StrToD() to convert text to array of floating point numbers. I couldn't undrestand, why it works so slowly? Running it under debbugger, I realized what was the problem. This stupid function scanned the whole file, looking for null terminator! I think, there is no reason to scan long text string after set of chars, belonging to the first number has been obtained. Finally I had to write my own realisation of this function.
|
|
|
|
|
strtod (that is the 'standard' C++ strtod , I never heard about StrToD ) is not 'strange': it is a function satisfying its own requirements that are clearly explained, for instance here[^]. If it doesn't fit your needs, then, well, the right way is to write your own one (as you did).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
You are right about lowercase: strtod(const char *nptr, char **endptr) returns floating point value and a pointer to the first char, that stops scanning. It means, that if I have for example such string "12.3 0.07" and give pointer to this string to strtod for eating, it will return me 12.3 and pointer to the next char after '3'. Thats all right, no objections. But name me one reason to scan THE WHOLE string??? Why do not stop scanning after four first chars? It is my non-humble opinion: it typical left-hand approach.
|
|
|
|
|
strtod uses strlen, internally - at least in VS2008.
but VS2010 fixes this, reportedly.
|
|
|
|
|
I use VS2005. I like it and this example of strange behavior is the only one what I actually met. No matter, build-in assembler lets me write compact and efficient procedures, when and if I have need in extra performance.
|
|
|
|
|
Looks like you found a bug.
|
|
|
|
|
I wouldn't say so: procedure works correctly. It is only inefficient realization, no more. I met a real bug in VS 6.0, but now it is of no use to speak about such ancient soft. Sometimes VS2005 asks me for confirmation, when I try to close prog, currently running under debugger, but it happens probably due to old age of my particulat exemplar.
|
|
|
|
|
Hi,
Can we write a C program to get a particular column values from an EXCEL file and use them as input for another file.
Eg: I want to retrieve all the values of the 3rd column of an excel file and then use that value for searching in another text file and finally replacing it with "xyz".
Thanks,
Faez
|
|
|
|
|
Yes, we can.
You may have a look at one of the many articles about Excel automation[^] here at CodeProject .
They are mainly focused on C++ language however.
In fact the bad news of your task are that you have to call COM from C (feasible but bit involuted).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I read the article regarding Excel automation and COM but could not find anything about extraction of values from a particular column of an Excel file.
I am using Eclipse IDE and gotta write a C code to open an Excel file and extract its fourth and fifth column values.
Any kinda help would be appreciated.
Thanks,
Faez
|
|
|
|
|
|
The below link helped me..
http://www.libxl.com
But now am facing other different problem
http://www.codeproject.com/Messages/4144507/Re-Undefined-reference-error-while-using-libxl-lib.aspx
Thanks for help
|
|
|
|
|
Need help to understand this line of code
step = (struct MyStep*)BigStep
given,
typedef struct MyStep {...structure definition...};
const struct MyStep BigStep[]{...an array of MyStep...};
Thank you
|
|
|
|
|
I don't know what version of C/C++ that is but it looks wrong to me. Why not show the exact code that you are trying to understand?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
That:
- Takes
BigStep (the address of the array of const MyStep structs ). - Casts it to
struct Mystep * (hence discarding the const constraint). - Assigns the result to
step (that is probably defined as struct MyStep * ).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
Ebe72 wrote: step = (struct MyStep*)BigStep given, typedef struct MyStep {...structure
definition...}; const struct MyStep BigStep[]{...an array of MyStep...};
Sorry, but by itself, this is Absolutely Meaningless. Firmware, Hardware, or Software Coding, makes no Real difference. It is something written in 'C'.
Question 1. Does your Code Compile.
If it does, you're lucky!
Question 2.
Does your code do what it is supposed to do.
If the answer is 'Yes' set a number of breakpoints around where the structure is used, and that will soon tell you (May take some patience) what happens, and what's what.
If your code does not Compile, you probably left out a Header. If it compiles, but does not link, you left out Library References.
If it Compiles and Links, but does not do what you expect, go back to the Docks and find out what it was supposed to do in the First Place!
Set Breakpoints, and find out what's going on.
This is a process called 'Debugging' It takes Time Skill and cunning, and the gray cells of 'Hercule Poirot'. It cannot be thaught as such, but you get experienced with your best friend, your Compiler.
Famous Chestnuts:-
<br />
if(x=0){...Do Something...} (Never Happens)<br />
<br />
int x==1;<br />
<br />
for(x=0;x=10;x++){...Do Something...}<br />
switch(){
break;<br />
}<br />
Hope this helps, if not, we need to see a little bit more than two lines of code, part of a Structure Definition. We are Not mindreaders
Bram van Kampen
|
|
|
|
|
BigStep[] is an array of MyStep structures. BigStep is a pointer to that array, iem the address of the first storage hole. ie, &BigStep[0].
'step as (MyStpe*)BigStep' points another pointer, this one a non const I assume (depending on how 'step' is declared), to the same address.
(BTW with the typedef you dont need to use ctruct MyStep* as the cast, MyStep* alone will compile since it is a new defined type.)
==============================
Nothing to say.
|
|
|
|
|
In VC6 when we use ::ifstream.open("test.txt") call creates a file if the specified file is not found in the location. But in VS2010 it does not create a file when its not found. Why is this differece and how to resolve this problem?
|
|
|
|
|
It looks VS2010 is more 'compliant' (see ifstream::open[^]).
It doesn't look a problem to me, however you may provide the second argument with the open mode you wish, if you need.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
i m wonderring which second argument option will work like as vc6.
|
|
|
|