C常用函数
检查空格字符
#include <ctype.h>
int isspace ( int c );
http://www.cplusplus.com/reference/clibrary/cctype/isspace/
Checks if parameter c is a white-space character.For the purpose of this function, standard white-space characters are:
' '
(0x20)
space (SPC)
'\t'
(0x09)
horizontal tab (TAB)
'\n'
(0x0a)
newline (LF)
'\v'
(0x0b)
vertical tab (VT)
'\f'
(0x0c)
feed (FF)
'\r'
(0x0d)
carriage return (CR)
/* isspace example */
#include <stdio.h>
#include <ctype.h>
int main ()
{
int c;
int i=0;
char str[]="Example sentence to test isspace\n";
while (str[i])
{
c=str[i];
if (isspace(c)) c='\n';
putchar (c);
i++;
}
return 0;
}
/*
This code prints out the C string character by character, replacing any white-space character by a newline character. Output:
Example
sentence
to
test
isspace
*/
memcpy实现:
char *strcpy(char *strDest, const char *strSrc){
assert((strDest!=NULL) && (strSrc !=NULL)); // 2分
char *address = strDest; // 2分
while( (*strDest++ = * strSrc++) != '\0' ) // 2分
NULL ;
return address ; // 2分
}
相关文档:
#include <stdio.h>
#include <unistd.h>
#define FOO "foo"
int main(void)
{
if(!access(FOO, F_OK))
{
if(!unlink(FOO))
{
}
else
{
printf("remove %s failed\n", FOO);
}
}
else
{
printf("%s not existed\ ......
学习C语言时,用字符串的函数例如stpcpy()、strcat()、strcmp()等,要包含头文件string.h
学习C++后,C++有字符串的标准类string,string类也有很多方法,用string类时要用到string.h头文件。
我现在看vc的书上也有CString类,这个要包含什么,怎么用?
我现在很迷惑,这两个 string.h有什么区别。是怎么回事
且看 ......
Netbeans经常会出现写代码的时候代码提示出不来的情况,甚至是代码根本没错,编译都能通过,但是代码帮助就提示我说我有错误,在下面画条红线!而这些问题Eclipse没有出现过!而且Eclipse有专门的CDT插件开发小组,很好强大。 ......
今天解答一些同学在学开发过程中的普遍问题,就是如何学好一门语言?
我是这样来理解的,要做任何事物,首先要分析为什么要做,只有把核心的,内心的原因找到才能把一件事情做好,否则,你花再多的学费学某种技术仍然会一无所或,从我个人的成长过程来将我是从97年接触计算机,开始学的一踏糊涂,不知道老师在讲什么,不知道学了会有什 ......
网上看到的这篇关于Linux下C语言嵌入汇编的文章写的非常全,转载过来。
Using Assembly Language in Linux.
Intel和AT&T汇编语法差异:
1。前缀:
Intel汇编寄存器和立即数无需前缀。后者寄存器前缀为%,立即数前缀为$。
eg:
Intex Syntax
mov eax,1
mov ebx,0f ......