Actually, it's more the debugger than the language itself that I have problems
with.
Everybody's all over themselves to tell you how to program, whether it be in
Pascal, Modula 2, C, C++, Java, C#, Prolog, Scheme, whathaveyou, but they're
a little shy I find, when it comes to explaining matters like the debugger,
etc.
Anyway, that's just my observation. Everybody else writes perfect code, I
assume ;)
Wesley Parish
On Friday 28 March 2003 12:07 am, you wrote:
> Hi Daniel,
>
> Get a good book on C or C++ programming, and learn to use the debugger
> and step through your programs and take a close look at what is
> happening!
>
>
> On Thu, 27 Mar 2003, Daniel Fone wrote:
>
> [...]
>
> > if(myfile = NULL)
>
> if(myfile == NULL)
>
> While it is technically possible (and also quite useful) to do
> assignments inside the argument of a conditional operator, you
> probably mean to check whether there is a file ...
>
> [...]
>
> > char * sQuote;
>
> Now, this will lead to trouble: you have defined a pointer to char,
> but you have not allocated any memory for storing a certain number of
> chars. That means you can happily set your pointer somewhere, as long
> as you do not try to store any chars.
>
> If you use this one
>
> char sQuote[256];
>
> you will also have a pointer to char, but at the same time the space
> is allocated.
>
> > fgets(sQuote, 256, myfile);
>
> So here it happened: you were trying to write data to some memory
> location. That would cause a memory access problem.
>
> > printf(sQuote);
>
> Or printf("%s\n",sQuote);
>
> This is just from memory, I have not debugged the thing. But I hope it
> helps you a bit further.
>
>
> Cheers,
>
> Helmut.
>
> +----------------+
>
> | Helmut Walle |
> | [EMAIL PROTECTED] |
> | 03 - 388 39 54 |
>
> +----------------+
--
Mau e ki, "He aha te mea nui?"
You ask, "What is the most important thing?"
Maku e ki, "He tangata, he tangata, he tangata."
I reply, "It is people, it is people, it is people."