Pelles C forum

C language => Beginner questions => Topic started by: Grincheux on February 21, 2016, 04:56:59 AM

Title: sprintf-s
Post by: Grincheux on February 21, 2016, 04:56:59 AM
Why is ther no sprintf_s in Pelle'c C compiler? :(
Code: [Select]
#ifdef __POCC__
sprintf(_szImgRatio,"%16.8f",_dImgRatio) ;
sprintf(_szResult,szSQL_Insert,__iItem,__iImage,__lParam,_dwFileSize,_dwImageSize,_dwImageWidth,_dwImageHeight,_szImgRatio,_szFile_MD5,_szImage_MD5,__lpszCurrentFile) ;
#else
sprintf_s(_szImgRatio,sizeof(_szImgRatio),"%16.8f",_dImgRatio) ;
sprintf_s(_szResult,sizeof(_szResult),szSQL_Insert,__iItem,__iImage,__lParam,_dwFileSize,_dwImageSize,_dwImageWidth,_dwImageHeight,_szImgRatio,_szFile_MD5,_szImage_MD5,__lpszCurrentFile) ;
#endif
Title: Re: sprintf-s
Post by: JohnF on February 21, 2016, 08:41:38 AM
It's in the help file.

=====
Declared in:
<stdio.h>

Description:
The sprintf_s function is equivalent to the sprintf function except for the parameter max and the explicit runtime-constraints.
=====

Edit: I can't get it working though! :(

Yes I can

#define __STDC_WANT_LIB_EXT1__ 1
#include <stdio.h>

John



Title: Re: sprintf-s
Post by: Grincheux on February 21, 2016, 10:03:08 AM
Thanks, I made change it's ok.