包括c中的sprintf_s方法

时间:2014-11-01 21:06:11

标签: c

我正在用c编写一些代码,这些代码将在linux中编译,并带有gcc -pedantic-errors。

我收到以下错误:

隐式声明函数'sprintf_s'

我的文件包含

任何人都可以帮忙解决这个问题吗?

这是产生问题的代码:

#include "chessproj.h"
#include "StringsList.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h> 
#include <time.h>


void add_move_to_list(int fromL, int fromH, int toL, int toH, struct linked_list * list) {
    char possible_move[50];
    char charStartHeight = fromH + 48 + 1;
    char charStartLength = fromL + 96 + 1;
    char charEndHeight = toH + 48 + 1;
    char charEndLength = toL + 96 + 1;
    sprintf_s(possible_move,"<%c,%c> to <%c,%c>", charStartLength, charStartHeight, charEndLength, charEndHeight);
    add_node(list, possible_move, apply_move_and_return_new_game_board(possible_move));
}

0 个答案:

没有答案