gpt4 book ai didi

c - strcpy "address pointing at code space is taken"出现错误

转载 作者:行者123 更新时间:2023-11-30 18:05:20 24 4
gpt4 key购买 nike

  #pragma inspect, symbols

#pragma nolist

#pragma ENV LIBSPACE

#include <stdio.h>

#include <string.h>

#include <tal.h>

#include <cextdecs(FILE_OPEN_,FILE_CLOSE_,FILE_GETINFO_,FILENAME_DECOMPOSE_,WRITEX,READX,FILE_SETKEY_,WRITEUPDATEX,FILENAME_RESOLVE_,FILE_SETPOSITION_,PROCESS_GETINFOLIST_,USER_GETINFO_,FILENAME_MATCH_)>

#include <fcntl.h>

#include <stdlib.h>

#include <stddef.h>

#include <ctype.h>

#include "$SYSTEM.ZSYSDEFS.ZSYSC (filename_constant,process_itemcodes)"

#pragma list

/*VARIABLES*/

const char program_id_DB[] = "CSRTST";
const char program_name_DB_c[ZSYS_VAL_LEN_FILENAME] = {"$DSMSCM.CSR.CSRTST"};


/*PROCESS COMMAND FUNCTION*/

processCMD(char string[])
{


struct local_stack_def{

_cc_status cc;
char command_E[30];
char DataEntry[200];
char user_id_E[200];
char curr_vol_subvol[ZSYS_VAL_LEN_FILENAME];
char program_name_DB[ZSYS_VAL_LEN_FILENAME];
short ret_attr_count;
short ret_values_maxlen;
short user_maxlen;
char curr_vol_subvol_t;
int x, j, val1, val2, val3;
short user_curlen, piece_length, fullname_length;
short fpointer, error, resultFD,resultFM, resultUGI,resultGIL, resultFR,ret_val_length;
union {
long id_32;
short id_16[2];
} user_id;
struct {
short paid;
short prgm_len;
char prgm_name_E[ZSYS_VAL_LEN_FILENAME];
} ret_vals;

struct {
char val[20];
} command_DB[2];
struct {
char val4[50];
} user_id_DB[2];


short attr_listX[2];
};

struct local_stack_def l_temp;
struct local_stack_def *l = &l_temp;

strcpy(&l->curr_vol_subvol_t,"x");

最佳答案

curr_vol_subvol_t 被声明为 char。您无法将空终止的 C 字符串 "x" 复制到单个 char 中。您需要一个至少包含 2 个成员的 char 数组,或者您可以将一个 char(例如 'x')分配给 curr_vol_subvol_t 如果这就是你真正想要的。

关于c - strcpy "address pointing at code space is taken"出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6572492/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com