Форум программистов
 

Восстановите пароль или Зарегистрируйтесь на форуме, о проблемах и с заказом рекламы пишите сюда - alarforum@yandex.ru, проверяйте папку спам!

Вернуться   Форум программистов > C/C++ программирование > Общие вопросы C/C++
Регистрация

Восстановить пароль
Повторная активизация e-mail

Купить рекламу на форуме - 42 тыс руб за месяц

Ответ
 
Опции темы Поиск в этой теме
Старый 12.06.2008, 17:19   #1
DmT
Пользователь
 
Регистрация: 06.10.2007
Сообщений: 32
Восклицание sscanf

Нужен исходный код этой могучей фунции sscanf(не scanf)
которая описана так:
int sscanf(const char *buffer, const char *format [, arguments,]);
Очень нужно!
Заранее спасибо.
С ув., Дмитрий.
DmT вне форума Ответить с цитированием
Старый 12.06.2008, 17:29   #2
B_N
Новичок
Джуниор
 
Регистрация: 18.01.2008
Сообщений: 1,720
По умолчанию

А Вы с чем именно работаете? Например и MS, и Borland дают исходники в чистом виде на всю CRT вместе с средой.
B_N вне форума Ответить с цитированием
Старый 12.06.2008, 17:38   #3
DmT
Пользователь
 
Регистрация: 06.10.2007
Сообщений: 32
По умолчанию

Дело в том что у меня сейчас нет ни одной среды разработки
Есть только компилятор и линкер ну и некоторый СДК которыми я компилю в формат ELF.
Нет, если постараться можно найти у коллег С++Builder и установить, но я хотел отделаться попроще.
DmT вне форума Ответить с цитированием
Старый 12.06.2008, 17:49   #4
B_N
Новичок
Джуниор
 
Регистрация: 18.01.2008
Сообщений: 1,720
По умолчанию

А в таком виде пойдёт?
http://fxr.watson.org/fxr/source/osf...nf.c?v=xnu-517
--------------
До кучи ещё вариант от MS:
Код:
/***
*sscanf.c - read formatted data from string
*
*       Copyright (c) 1985-2001, Microsoft Corporation. All rights reserved.
*
*Purpose:
*       defines scanf() - reads formatted data from string
*
*******************************************************************************/

#include <cruntime.h>
#include <stdio.h>
#include <dbgint.h>
#include <stdarg.h>
#include <string.h>
#include <internal.h>
#include <mtdll.h>
#include <tchar.h>

/***
*int sscanf(string, format, ...) - read formatted data from string
*
*Purpose:
*       Reads formatted data from string into arguments.  _input does the real
*       work here.  Sets up a FILE so file i/o operations can be used, makes
*       string look like a huge buffer to it, but _filbuf will refuse to refill
*       it if it is exhausted.
*
*       Allocate the 'fake' _iob[] entryit statically instead of on
*       the stack so that other routines can assume that _iob[] entries are in
*       are in DGROUP and, thus, are near.
*
*       Multi-thread: (1) Since there is no stream, this routine must never try
*       to get the stream lock (i.e., there is no stream lock either).  (2)
*       Also, since there is only one staticly allocated 'fake' iob, we must
*       lock/unlock to prevent collisions.
*
*Entry:
*       char *string - string to read data from
*       char *format - format string
*       followed by list of pointers to storage for the data read.  The number
*       and type are controlled by the format string.
*
*Exit:
*       returns number of fields read and assigned
*
*Exceptions:
*
*******************************************************************************/
/***
*int snscanf(string, size, format, ...) - read formatted data from string of
*    given length
*
*Purpose:
*       Reads formatted data from string into arguments.  _input does the real
*       work here.  Sets up a FILE so file i/o operations can be used, makes
*       string look like a huge buffer to it, but _filbuf will refuse to refill
*       it if it is exhausted.
*
*       Allocate the 'fake' _iob[] entryit statically instead of on
*       the stack so that other routines can assume that _iob[] entries are in
*       are in DGROUP and, thus, are near.
*
*       Multi-thread: (1) Since there is no stream, this routine must never try
*       to get the stream lock (i.e., there is no stream lock either).  (2)
*       Also, since there is only one staticly allocated 'fake' iob, we must
*       lock/unlock to prevent collisions.
*
*Entry:
*       char *string - string to read data from
*       size_t count - length of string
*       char *format - format string
*       followed by list of pointers to storage for the data read.  The number
*       and type are controlled by the format string.
*
*Exit:
*       returns number of fields read and assigned
*
*Exceptions:
*
*******************************************************************************/
#ifdef _UNICODE
#ifdef _SNSCANF
int __cdecl _snwscanf (
#else  /* _SNSCANF */
int __cdecl swscanf (
#endif  /* _SNSCANF */
#else  /* _UNICODE */
#ifdef _SNSCANF
int __cdecl _snscanf (
#else  /* _SNSCANF */
int __cdecl sscanf (
#endif  /* _SNSCANF */
#endif  /* _UNICODE */
        REG2 const _TCHAR *string,
#ifdef _SNSCANF
        size_t count,
#endif  /* _SNSCANF */
        const _TCHAR *format,
        ...
        )
/*
 * 'S'tring 'SCAN', 'F'ormatted
 */
{
        va_list arglist;
        FILE str;
        REG1 FILE *infile = &str;
        REG2 int retval;

        va_start(arglist, format);

        _ASSERTE(string != NULL);
        _ASSERTE(format != NULL);

        infile->_flag = _IOREAD|_IOSTRG|_IOMYBUF;
        infile->_ptr = infile->_base = (char *) string;
#ifdef _SNSCANF
        infile->_cnt = (int)count*sizeof(_TCHAR);
#else  /* _SNSCANF */
        infile->_cnt = ((int)_tcslen(string))*sizeof(_TCHAR);
#endif  /* _SNSCANF */
#ifdef _UNICODE
        retval = (_winput(infile,format,arglist));
#else  /* _UNICODE */
        retval = (_input(infile,format,arglist));
#endif  /* _UNICODE */

        return(retval);
}
B_N вне форума Ответить с цитированием
Старый 12.06.2008, 18:15   #5
DmT
Пользователь
 
Регистрация: 06.10.2007
Сообщений: 32
По умолчанию

Ещё варианты есть?
DmT вне форума Ответить с цитированием
Ответ


Купить рекламу на форуме - 42 тыс руб за месяц