This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I am trying to use the function snprintf() in the #include<stdio> library. However, when I build I find the function does not exist. When I open up the "stdio library" file, I see it is from 1986-1999 and that function does not exist.
However, I have another project where I also use the function snprintf() in the #include<stdio> library and I have no issue. When I open up the "stdio library" file, I see it is from 2003-2010 and the function exists.
How do I include the more recent library such that I can use this function?
Thanks,
Beau
Hi Beau,
What version of IAR are you using? I've got IAR EW430 7.12.2 and looking in the "C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.0\430\inc\clib" folder, I found the 'stdio.h' file. At the top, it shows "Copyright 1986 - 1999 IAR Systems". However, I did find the sprintf() function in this file as you can see below. Perhaps you can update your include paths for the failing project or replace the file with the one that has this function.
/* - STDIO.H - Subset of ANSI standard I/O function declarations. $Revision: 49720 $ Copyright 1986 - 1999 IAR Systems. All rights reserved. */ #ifndef _STDIO_INCLUDED #define _STDIO_INCLUDED #ifndef _SYSTEM_BUILD #pragma system_include #endif #include "sysmac.h" #include "stdarg.h" #ifndef NULL #define NULL ((void *) 0) #endif #ifndef EOF #define EOF (-1) #endif #ifndef MEMORY_ATTRIBUTE #define MEMORY_ATTRIBUTE #endif #ifdef _HAS_PRAGMA_PRINTF_ARGS #define __PRINTFPR _Pragma("__printf_args") \ _Pragma("library_default_requirements _formatted_write = unknown") #define __SCANFPR _Pragma("__scanf_args") \ _Pragma("library_default_requirements _formatted_read = unknown") #else #define __PRINTFPR #define __SCANFPR #endif __EFF_NW1 MEMORY_ATTRIBUTE int puts(const char *); MEMORY_ATTRIBUTE int putchar(int); MEMORY_ATTRIBUTE int getchar(void); __EFF_NR1NW2 __PRINTFPR MEMORY_ATTRIBUTE int sprintf(char *,const char *,...); __EFF_NR1NW2 __PRINTFPR MEMORY_ATTRIBUTE int vsprintf(char *,const char *, va_list); __EFF_NW1 __PRINTFPR MEMORY_ATTRIBUTE int printf(const char *,...); __EFF_NW1 __PRINTFPR MEMORY_ATTRIBUTE int vprintf(const char *,va_list); __EFF_NW1 __SCANFPR MEMORY_ATTRIBUTE int scanf(const char *,...); __EFF_NW1NW2 __SCANFPR MEMORY_ATTRIBUTE int sscanf(const char *, const char *,...); __EFF_NR1 MEMORY_ATTRIBUTE char *gets(char *); #endif /* _STDIO_INCLUDED */
Regards,
James
**Attention** This is a public forum