Read binary file with line delimeter
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 156

Thread: Read binary file with line delimeter

Threaded View

  1. #35
    Join Date
    Oct 2013
    Posts
    63

    Re: Read binary file with line delimeter

    Hello Paul,

    I run with debugger and appear this file refering the error to line 142 (in red):
    Code:
    /***
    *xtoa.c - convert integers/longs to ASCII string
    *
    *       Copyright (c) Microsoft Corporation. All rights reserved.
    *
    *Purpose:
    *       The module has code to convert integers/longs to ASCII strings.  See
    *
    *******************************************************************************/
    
    #include <cruntime.h>
    #include <stdlib.h>
    #include <limits.h>
    #include <tchar.h>
    #include <internal.h>
    #include <internal_securecrt.h>
    
    #ifdef _UNICODE
    #define xtox_s     xtow_s
    #define _itox_s    _itow_s
    #define _ltox_s    _ltow_s
    #define _ultox_s   _ultow_s
    #define x64tox_s   x64tow_s
    #define _i64tox_s  _i64tow_s
    #define _ui64tox_s _ui64tow_s
    #define xtox       xtow
    #define _itox      _itow
    #define _ltox      _ltow
    #define _ultox     _ultow
    #define x64tox     x64tow
    #define _i64tox    _i64tow
    #define _ui64tox   _ui64tow
    #else  /* _UNICODE */
    #define xtox_s     xtoa_s
    #define _itox_s    _itoa_s
    #define _ltox_s    _ltoa_s
    #define _ultox_s   _ultoa_s
    #define x64tox_s   x64toa_s
    #define _i64tox_s  _i64toa_s
    #define _ui64tox_s _ui64toa_s
    #define xtox       xtoa
    #define _itox      _itoa
    #define _ltox      _ltoa
    #define _ultox     _ultoa
    #define x64tox     x64toa
    #define _i64tox    _i64toa
    #define _ui64tox   _ui64toa
    #endif  /* _UNICODE */
    ..
    .
    .
    .
    
    #else  /* _SECURE_ITOA */
                length++;
            } while (val > 0 && length < sizeInTChars);
    
            /* Check for buffer overrun */
            if (length >= sizeInTChars)
            {
                buf[0] = '\0';
                _VALIDATE_RETURN_ERRCODE(length < sizeInTChars, ERANGE);
            }
    #endif  /* _SECURE_ITOA */
            /* We now have the digit of the number in the buffer, but in reverse
               order.  Thus we reverse them now. */
    
            *p-- = _T('\0');            /* terminate string; p points to last digit */
    In the calls stack window appears this
    Code:
    =>	msvcr110d.dll!xtoa_s(unsigned long val, char * buf, unsigned int sizeInTChars, unsigned int radix, int is_neg) Line 142	C
     	msvcr110d.dll!_itoa_s(int val, char * buf, unsigned int sizeInTChars, int radix) Line 176	C
     	Get_Blocks.exe!main(int argc, char * * argv) Line 224	C++
     	Get_Blocks.exe!__tmainCRTStartup() Line 536	C
     	Get_Blocks.exe!mainCRTStartup() Line 377	C
     	kernel32.dll!7695336a()	Unknown
    	[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]
     	ntdll.dll!76f19f72()	Unknown
     	ntdll.dll!76f19f45()	Unknown
    It seems could be becuase to _itoa_s(), I'm using like this:
    Code:
     _itoa_s(CONVDEC(i), num, 10, 10);
    	    sub += num;
    Last edited by Philidor; November 2nd, 2013 at 04:15 PM.

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