std::list and fgets???????? 
Author Message
 std::list and fgets????????

Are there any know problems between std::list and fgets as in my program if
try to use a function of std::list class before I use fgets the std::list
class function works fine, but if I try to use the same std::list class
function after using fgets it no longer works, e.g. it complies ok then when
run cause memory errors

thanks for any help

Pete



Sat, 11 Oct 2003 21:03:18 GMT  
 std::list and fgets????????
I guess your use of fgets corrupts memory and std::list just happens to be
the first call that is affected. Show some code.
--
With best wishes,
    Igor Tandetnik


Quote:
> Are there any know problems between std::list and fgets as in my program
if
> try to use a function of std::list class before I use fgets the std::list
> class function works fine, but if I try to use the same std::list class
> function after using fgets it no longer works, e.g. it complies ok then
when
> run cause memory errors

> thanks for any help

> Pete



Sat, 11 Oct 2003 21:46:50 GMT  
 std::list and fgets????????
fgets is a standard ANSI function (not one I have written), fgets gets a
string from a file stream of a specified length.

As far as I under stand the stl is meant to work correctly with ANSI code
and compilers (e.g. the one in VS)



Quote:
> I guess your use of fgets corrupts memory and std::list just happens to be
> the first call that is affected. Show some code.
> --
> With best wishes,
>     Igor Tandetnik



> > Are there any know problems between std::list and fgets as in my program
> if
> > try to use a function of std::list class before I use fgets the
std::list
> > class function works fine, but if I try to use the same std::list class
> > function after using fgets it no longer works, e.g. it complies ok then
> when
> > run cause memory errors

> > thanks for any help

> > Pete



Sat, 11 Oct 2003 21:58:53 GMT  
 std::list and fgets????????

Quote:
> fgets is a standard ANSI function (not one I have written), fgets gets a
> string from a file stream of a specified length.

> As far as I under stand the stl is meant to work correctly with ANSI code
> and compilers (e.g. the one in VS)

What does this have to do with anything? Like Igor said, post some code. And
don't top post.

NeilB



Sat, 11 Oct 2003 21:35:13 GMT  
 std::list and fgets????????
The fact that the function is standard doesn't prevent the programmer from
misusing it. Every function has preconditions that have to be met, which
leaves a freedom for the programmer not to meet them.

In case of fgets, you may have something like

char s[1];
fgets(s, 1024, f);

No telling where the program breaks after that.
--
With best wishes,
    Igor Tandetnik


Quote:
> fgets is a standard ANSI function (not one I have written), fgets gets a
> string from a file stream of a specified length.

> As far as I under stand the stl is meant to work correctly with ANSI code
> and compilers (e.g. the one in VS)



> > I guess your use of fgets corrupts memory and std::list just happens to
be
> > the first call that is affected. Show some code.
> > --
> > With best wishes,
> >     Igor Tandetnik



> > > Are there any know problems between std::list and fgets as in my
program
> > if
> > > try to use a function of std::list class before I use fgets the
> std::list
> > > class function works fine, but if I try to use the same std::list
class
> > > function after using fgets it no longer works, e.g. it complies ok
then
> > when
> > > run cause memory errors

> > > thanks for any help

> > > Pete



Sat, 11 Oct 2003 22:42:06 GMT  
 std::list and fgets????????
The answer is you lot do not know because if you did would know, what I was
talking about and not be asking about code. I asked if there where known
problems the answer is no you do not know of any.

and as for top posting I am in Germany on CET (central european time), and
these news groups post with your system time, so when I post I am about 6
hours ahead of you, this will always happen with anyone posting that lives I
a time zone ahead of yours, it will also happen your 3 and I am assuming you
are from the USA or there abouts time zones AST, EDT, and CST. Look it
up.....



Quote:
> The fact that the function is standard doesn't prevent the programmer from
> misusing it. Every function has preconditions that have to be met, which
> leaves a freedom for the programmer not to meet them.

> In case of fgets, you may have something like

> char s[1];
> fgets(s, 1024, f);

> No telling where the program breaks after that.
> --
> With best wishes,
>     Igor Tandetnik



> > fgets is a standard ANSI function (not one I have written), fgets gets a
> > string from a file stream of a specified length.

> > As far as I under stand the stl is meant to work correctly with ANSI
code
> > and compilers (e.g. the one in VS)



> > > I guess your use of fgets corrupts memory and std::list just happens
to
> be
> > > the first call that is affected. Show some code.
> > > --
> > > With best wishes,
> > >     Igor Tandetnik



> > > > Are there any know problems between std::list and fgets as in my
> program
> > > if
> > > > try to use a function of std::list class before I use fgets the
> > std::list
> > > > class function works fine, but if I try to use the same std::list
> class
> > > > function after using fgets it no longer works, e.g. it complies ok
> then
> > > when
> > > > run cause memory errors

> > > > thanks for any help

> > > > Pete



Sun, 12 Oct 2003 14:59:26 GMT  
 std::list and fgets????????
Insulting people is not a good way to get an answer.  Did it ever occur to
you that if multiple people are asking the same thing, then perhaps they
might have a reason?

fgets will happily write data into whatever pointer you give it, whether
there is actual allocated storage there or not.  If you overrun the
boundaries of your storage, it will start writing over adjacent data, which
will in fact give the results you are seeing.

That is what they are saying, and what you are blindly missing while
insulting people.


Quote:
> The answer is you lot do not know because if you did would know, what I
was
> talking about and not be asking about code. I asked if there where known
> problems the answer is no you do not know of any.

> and as for top posting I am in Germany on CET (central european time), and
> these news groups post with your system time, so when I post I am about 6
> hours ahead of you, this will always happen with anyone posting that lives
I
> a time zone ahead of yours, it will also happen your 3 and I am assuming
you
> are from the USA or there abouts time zones AST, EDT, and CST. Look it
> up.....



> > The fact that the function is standard doesn't prevent the programmer
from
> > misusing it. Every function has preconditions that have to be met, which
> > leaves a freedom for the programmer not to meet them.

> > In case of fgets, you may have something like

> > char s[1];
> > fgets(s, 1024, f);

> > No telling where the program breaks after that.
> > --
> > With best wishes,
> >     Igor Tandetnik



> > > fgets is a standard ANSI function (not one I have written), fgets gets
a
> > > string from a file stream of a specified length.

> > > As far as I under stand the stl is meant to work correctly with ANSI
> code
> > > and compilers (e.g. the one in VS)



> > > > I guess your use of fgets corrupts memory and std::list just happens
> to
> > be
> > > > the first call that is affected. Show some code.
> > > > --
> > > > With best wishes,
> > > >     Igor Tandetnik



> > > > > Are there any know problems between std::list and fgets as in my
> > program
> > > > if
> > > > > try to use a function of std::list class before I use fgets the
> > > std::list
> > > > > class function works fine, but if I try to use the same std::list
> > class
> > > > > function after using fgets it no longer works, e.g. it complies ok
> > then
> > > > when
> > > > > run cause memory errors

> > > > > thanks for any help

> > > > > Pete



Sun, 12 Oct 2003 17:42:34 GMT  
 std::list and fgets????????

Quote:
> Are there any know problems between std::list and fgets ..

Not that I know of.
The overwhelming likelyhood is that you are using it incorrectly
And without you posting any code, nobody can mind read what your mistake is.

Also, if you had hung around in this newsgroup a bit, some of the people who
answered you have been here a very long time. They have seen just about
everything regarding the STL that ships with VC++.

Stephen Howe



Mon, 13 Oct 2003 05:02:00 GMT  
 std::list and fgets????????

Quote:
> The answer is you lot do not know because if you did would know, what I
was
> talking about and not be asking about code. I asked if there where known
> problems the answer is no you do not know of any.

Nah, we just don't like sharing our knowledge with idiots.

Quote:
> and as for top posting I am in Germany on CET (central european time), and
> these news groups post with your system time, so when I post I am about 6
> hours ahead of you, this will always happen with anyone posting that lives
I
> a time zone ahead of yours, it will also happen your 3 and I am assuming
you
> are from the USA or there abouts time zones AST, EDT, and CST. Look it
> up...

Top posting means prepending  your reply to the post you are replying to,
rather than appending it, thus making it difficult to read and understand..
It is another mark of an idiot. I can't see how you thought it was something
to do with timezones.

NeilB



Mon, 13 Oct 2003 04:31:55 GMT  
 std::list and fgets????????
Just an aside; English isn't orthogonal, prepend actually means 'to think
ahead'.  Many of us top posters like to believe that we do 'think ahead';
for instance, bottom posters can see at a glance that this message will
anger them and they can skip it.  That is why top posters prefix their
response to the original post.


Quote:
> Top posting means prepending  your reply to the post you are replying to,
> rather than appending it, thus making it difficult to read and

understand..


Tue, 14 Oct 2003 21:56:52 GMT  
 std::list and fgets????????

Quote:
> Just an aside; English isn't orthogonal, prepend actually means 'to think
> ahead'.

I stand corrected.

Quote:
> Many of us top posters like to believe that we do 'think ahead';
> for instance, bottom posters can see at a glance that this message will
> anger them and they can skip it.  That is why top posters prefix their
> response to the original post.

Shucks, and there was I thinking it was because they were too lazy to move
the cursor from Outlook Express's default position. But actually, they've
invested a lot of thought in developing this annoying habit. Well, you live
and learn.

NeilB



Tue, 14 Oct 2003 22:07:07 GMT  
 std::list and fgets????????

Quote:
> > Many of us top posters like to believe that we do 'think ahead';
> > for instance, bottom posters can see at a glance that this message will
> > anger them and they can skip it.  That is why top posters prefix their
> > response to the original post.

> Shucks, and there was I thinking it was because they were too lazy to move
> the cursor from Outlook Express's default position. But actually, they've
> invested a lot of thought in developing this annoying habit. Well, you
live
> and learn.

When a lot of context is necessary, it's easier to keep the context at the
bottom and the reply at the top, so those who know the context can quickly
get the latest message without scrolling, but those who aren't familiar can
still get the context.  It's also good when the other person's news reader
doesn't format things well, any inline responses would get lost in the mess.
Curteous top posters will trip the quoted text appropriately.

Personally, I use whichever seems most appropraite at the time, usually with
an eye to what's easiest for the reader (since there are a lot more readers
than writers for any one message).

Ken



Wed, 15 Oct 2003 01:58:20 GMT  
 
 [ 12 post ] 

 Relevant Pages 

1. std::list and fgets????????

2. std::list, std::vector, push_back() and associated ::iterator validity

3. list vs std::list

4. annoying fgets problem <fgets>

5. std::list.clear() throws exceptions in .NET 2003.

6. STD::LIST output

7. std::list + ComQIPtr = strange problem?

8. std::list

9. std::list<string>::sort (Cmp)

10. std::list<> problem

11. Predicates in std::list

12. Help with standard template library (std::list) in MSVC++5.0

 

 
Powered by phpBB® Forum Software