Debug Assertion Failed! due to the use of ifstream - Page 2
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 21 of 21

Thread: Debug Assertion Failed! due to the use of ifstream

  1. #16
    Join Date
    Dec 2013
    Posts
    14

    Re: Debug Assertion Failed! due to the use of ifstream

    Quote Originally Posted by 2kaud View Post
    In calcPayFixes, there are several lines of code like this
    Code:
    if (cnt <= payDates_.size())
    Are you sure this test should be <= and not < as the elements of the vector go from 0 to .size() -1?
    To be honnest, I cannot say since the whole code does not come from me. But I still working on this matter.
    Last edited by eBooster; March 12th, 2014 at 10:17 AM.

  2. #17
    Join Date
    Dec 2013
    Posts
    14

    Re: Debug Assertion Failed! due to the use of ifstream

    Quote Originally Posted by 2kaud View Post
    Possibly because of what I mentioned in my previous post #13.
    I tried your advice in post #13 without success.

  3. #18
    Join Date
    Dec 2012
    Location
    England
    Posts
    2,848

    Re: Debug Assertion Failed! due to the use of ifstream

    Quote Originally Posted by eBooster View Post
    To be honnest, I cannot say since the whole code does not come from me. But I still working on this matter.
    Are you sure that the parameters you are passing to the constructor of s are correct and valid?
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  4. #19
    Join Date
    Dec 2013
    Posts
    14

    Re: Debug Assertion Failed! due to the use of ifstream

    Quote Originally Posted by 2kaud View Post
    Are you sure that the parameters you are passing to the constructor of s are correct and valid?
    Yes, I have checked this, but I think it come from the source you said in post #13.
    Last edited by eBooster; March 12th, 2014 at 01:03 PM.

  5. #20
    Join Date
    Dec 2013
    Posts
    14

    Re: Debug Assertion Failed! due to the use of ifstream

    Quote Originally Posted by 2kaud View Post
    In calcPayFixes, there are several lines of code like this
    Code:
    if (cnt <= payDates_.size())
    Are you sure this test should be <= and not < as the elements of the vector go from 0 to .size() -1?
    You were since very close : the bug came from the second line after the one you highlighted.

    if (cnt <= payDates_.size())
    {
    if (cnt + payFrequency_ < payDates_.size()) //< instead of <=

  6. #21
    Join Date
    Dec 2012
    Location
    England
    Posts
    2,848

    Re: Debug Assertion Failed! due to the use of ifstream

    I'm pleased you found the issue. I'm always very wary when I see <= relating to elements of a container.
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center