在C编程中验证数据 [英] Validating Data in C programming

查看:64
本文介绍了在C编程中验证数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道如何在C中执行数据验证?我已经搜索了每个可能的结果,并且我最终得到了数据

验证C ++或者什么都没有。我也搜索过诸如planet-source-code.com之类的网站

,但是我的搜索一直是徒劳的。


有人可以帮帮我。或者至少,指向正确的方向

方向?


非常感谢你。 :)

Does anyone know how to perform data validation in C? I have searched
google for every possible result, and I either end up with data
validation for C++ or nothing at all. I have also searched websites
such as planet-source-code.com, but my search has been in vain.

Can someone please help me out. Or at least, point me in the right
direction?

Thank you very much. :)

推荐答案



gurdz写道:

gurdz wrote:

有谁知道如何在C中执行数据验证?我已经搜索了每个可能的结果,并且我最终得到了数据

验证C ++或者什么都没有。我也搜索过诸如planet-source-code.com之类的网站

,但是我的搜索一直是徒劳的。


有人可以帮帮我。或者至少,指向正确的方向

方向?


非常感谢你。 :)
Does anyone know how to perform data validation in C? I have searched
google for every possible result, and I either end up with data
validation for C++ or nothing at all. I have also searched websites
such as planet-source-code.com, but my search has been in vain.

Can someone please help me out. Or at least, point me in the right
direction?

Thank you very much. :)



数据验证是一种通用编程技术,它是一种语言

独立。这只是检查数据输入到你的程序是否在预期值等范围内的过程。如果你是
期望1到10之间的数字,在使用之前检查它是否是

1和10之间的数字。这有什么难的?除非我不是理解你的问题...

Data validation is a generic programming technique that is language
independant. It is just the process of checking that data input to
your program is within the range of expected values, etc. If you are
expecting a number between 1 and 10, check that it is a number between
1 and 10 before using it. What is so hard about that? Unless I am not
understanding your question...


gurdz写道:
gurdz wrote:

有谁知道如何在C中执行数据验证?
Does anyone know how to perform data validation in C?



是的,你查看数据并查看它是否符合你的验证规则。

Yes, you look at the data and see if it matches your validation rules.


我有搜索

谷歌搜索每一个可能的结果,我要么最终得到数据

验证C ++或什么都没有。我也搜索过诸如planet-source-code.com之类的网站

,但是我的搜索一直是徒劳的。


有人可以帮帮我。或者至少,指向正确的方向?
方向?
I have searched
google for every possible result, and I either end up with data
validation for C++ or nothing at all. I have also searched websites
such as planet-source-code.com, but my search has been in vain.

Can someone please help me out. Or at least, point me in the right
direction?



这实际上取决于您要验证的数据是什么,规则是什么,b $ b $以及数据的来源。没有任何一种尺寸

适合所有解决方案。

-

Flash Gordon

仍然在此计算机上无用。

It really depends on what the data you are trying to validate is, what
the rules are, and where the data is coming from. There is no one size
fits all solution.
--
Flash Gordon
Still sigless on this computer.


Flash Gordon说:


< snip>
Flash Gordon said:

<snip>

>

这取决于你要验证的数据是什么,

规则是,以及数据来自何处。没有一个尺寸

适合所有解决方案。
>
It really depends on what the data you are trying to validate is, what
the rules are, and where the data is coming from. There is no one size
fits all solution.



是的,有。


以下片段取自英国主要使用的源代码
银行,其身份将保持匿名(以保护有罪)。

在20世纪90年代末的Y2K工作期间被发现:


if(d!= 6)

{

d = 6;

}


中提琴!所有数字都是6,即使它们不是。 QED。


我们笑了多少!我们笑了笑,笑了,直到我们停下来。


-

Richard Heathfield

Usenet是一个奇怪的地方 ; - dmr 29/7/1999
http://www.cpax.org.uk

电子邮件:rjh在上面的域名(但显然放弃了www)

Yes, there is.

The following fragment is taken from the source code used by a major UK
bank, the identity of which will remain anonymous (to protect the guilty).
It was spotted during Y2K work in the late 1990s:

if(d != 6)
{
d = 6;
}

Viola! All numbers are 6, even if they aren''t. QED.

How we laughed! We laughed and laughed and laughed, until we stopped.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)


这篇关于在C编程中验证数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆