是否可以确定库中结构(C语言)中的元素(名称和数据类型)?如果是的话,怎么用C语言呢?如果C语言不支持它,是否可以通过其他技巧获取结构元素或者是否有任何工具?
我正在使用Ryan J. Heldt的验证CFC http://validation.riaforge.org/
我的表单提交到processSignup.cfc
<cfscript>
objValidation = createObject("component","cfcs.validation").init();
objValidation.setFields(form);
objValidation.validate();
</cfscript>
<!--- clear the error/success message --->
<cfset msg="">
<cfif objValidation.getErrorCount() is not 0>
<cfsavecontent variable="msg">
<H2>Error in form submission</H2>
<P>There were <cfoutput>#objValidation.getErrorCount()#</cfoutput> errors in your submission:</P>
<ul>
<cfloop collection="#variables.objValidation.getMessages()#" item="rr">
<li><cfoutput>#variables.objValidation.getMessage(rr)#</cfoutput></li>
</cfloop>
</ul>
<p>Please use the back button on your browser to correct your submission.</p>
</cfsavecontent>
</cfif>
<cfdump var="#objvalidation#">
<cfoutput>
#msg#
</cfoutput>
Run Code Online (Sandbox Code Playgroud)
这给了我这个输出

我正在尝试弄清楚的是结构的名称以及如何获得"确认密码","密码","用户名",但我是密集的,我无法弄清楚如何.
<!---
<fusedoc fuse="Validation.cfc" language="ColdFusion" specification="2.0">
<responsibilities>
I am a ColdFusion Component that performs server-side …Run Code Online (Sandbox Code Playgroud) 我有一个全局结构数组声明为
struct _links link[255][255][255];
Run Code Online (Sandbox Code Playgroud)
在我的 main.c. 这个结构数组也用在另一个文件action.c中,我尝试在action.c中将它声明为extern,即
extern struct _links link[255][255][255];
Run Code Online (Sandbox Code Playgroud)
但是,我收到错误消息“数组类型具有不完整的元素类型”。我不明白这是什么意思。我该如何解决这个问题?
谢谢你。
我对C++类中的变量范围有疑问.我正在研究的问题是创建一个包含结构数组的类,每个结构都包含特定类型饮料的名称,成本和金额.
该类应该有公共成员函数来购买饮料并显示菜单,私人函数用于获取和验证货币输入(由buy_drink调用)并显示结束日报告(由析构函数调用).
私有函数input_money中的范围有问题.我收到一个错误,说该数组尚未定义.我测试了display_data函数(用于打印菜单),它自己运行良好,但现在我无法弄清楚为什么input_money会有范围错误而display_data不会.这是头文件:
/* need to create a class that holds an array of
5 structures, each structure holding string drink name,
double cost, and int number in machine
class needs public functions to display data and
buy drink
private functions input money -- called by buy_drink to accept,
validate, and return to buy drink the amount of money input
daily report -- destructor that reports how much money
was made daily and how many pops are left in machine …Run Code Online (Sandbox Code Playgroud) 所以我创建了一个struct,其唯一元素是指向数组的指针.当我初始化这个数组时,我得到一个分段错误.你能告诉我为什么吗?
这是代码:
typedef struct {
int *data;
} A;
/* Class definition */
class C {
A* a;
public:
C(void);
};
/* Constructor */
C::C(void) {
a->data = new int[10];
}
int main(void) {
C();
}
Run Code Online (Sandbox Code Playgroud)
谢谢!
如何在D中将D结构转换为C指针?就像是:
struct test {}
void main() {
auto testv = test();
randomfunction(cast(cPtr) test);
}
Run Code Online (Sandbox Code Playgroud) 我有一个问题,即迭代地增加结构的大小.我找不到它的解决方案.
我需要的是有200个向量(名为EVE1-EVE200),作为结构的字段.我在matlab中编写了以下代码:
for i=1:200;
events=struct(['EVE' num2str(i)],[]);
end
Run Code Online (Sandbox Code Playgroud)
但它只是形成了最后的结构.有人请帮帮我吗?这种初始化数据库的方式是最好的方法吗?
#include<stdio.h>
struct stucture
{
int info;
};
typedef struct stucture * ts;
int main()
{
ts exp;
exp->info=10;
printf("working");
}
Run Code Online (Sandbox Code Playgroud)
我不知道这段代码有什么问题.不打印错误语句以便寻找解决方案.该程序刚刚终止.
我阅读了Nullable Structure并了解其中的大部分内容.但我不知道人们何时以及为何会使用它.
struct data
{
char name;
int conn[3];
};
typedef struct data unit;
typedef unit *link;
int main()
{
int i;
link p[100];
for(i=0;i<=100;i++)
{
p[i]=(link)malloc(sizeof(unit));
p[i]->name='h';
p[i]->conn[]=(int*){"1","1","1"}; **// assignment error**
}
for(i=0;i<=100;i++)
{
printf("%c\t%d\t%d\t%d\n",p[i]->name,p[i]->conn[0],p[i]->conn[1],p[i]->conn[2]);
}
getch();
}
Run Code Online (Sandbox Code Playgroud)
由于结构不支持初始化,所以有没有办法在不使用mem分配函数的情况下在一行代码中分配在结构内声明的这种类型的数组,为了简单起见?请坚持代码.