C ×Ö·û´®º¯Êý´óÈ«
º¯ÊýÃû: stpcpy
¹¦ ÄÜ: ¿½±´Ò»¸ö×Ö·û´®µ½ÁíÒ»¸ö
ÓÃ ·¨: char *stpcpy(char *destin, char *source);
³ÌÐòÀý:
#include <stdio.h>
#include <string.h>
int main(void)
{
char string[10];
char *str1 = "abcdefghi";
stpcpy(string, str1);
printf("%s\n", string);
return 0;
}
º¯ÊýÃû: strcat
¹¦ ÄÜ: ×Ö·û´®Æ´½Óº¯Êý
ÓÃ ·¨: char *strcat(char *destin, char *source);
³ÌÐòÀý:
#include <string.h>
#include <stdio.h>
int main(void)
{
char destination[25];
char *blank = " ", *c = "C++", *Borland = "Borland";
strcpy(destination, Borland);
strcat(destination, blank);
strcat(destination, c);
printf("%s\n", destination);
return 0;
}
º¯ÊýÃû: strchr
¹¦ ÄÜ: ÔÚÒ»¸ö´®ÖвéÕÒ¸ø¶¨×Ö·ûµÄµÚÒ»¸öÆ¥ÅäÖ®´¦\
ÓÃ ·¨: char *strchr(char *str, char c);
³ÌÐòÀý:
#include <string.h>
#include <stdio.h>
int main(void)
{
char string[15];
char *ptr, c = 'r';
strcpy(string, "This is a string");
ptr = strchr(string, c);
if (ptr)
printf("The character %c is at position: %d\n", c, ptr-string);
else
printf("The character was not found\n");
return 0;
}
º¯ÊýÃû: strcmp
¹¦ ÄÜ: ´®±È½Ï
ÓÃ ·¨: int strcmp(char *str1, char *str2);
¿´AsicÂ룬str1>str2£¬·µ»ØÖµ > 0£»Á½´®ÏàµÈ£¬·µ»Ø0
³ÌÐòÀý:
#include <string.h>
#include <stdio.h>
int main(void)
{
char *buf1 = "aaa", *buf2 = "bbb", *buf3 = "ccc";
int ptr;
ptr = strcmp(buf2, buf1);
if (ptr > 0)
printf("buffer 2 is greater than buffer 1\n");
else
Ïà¹ØÎĵµ£º
Ö÷Òª½²½²windows²Ù×÷ϵͳÔÚCÅ̿ռ䲻×ãµÄÇé¿öÏ£¬ÎÒÃÇ¿ÉÒÔͨ¹ýÄÇЩ¾ßÌåÊÖ¶ÎÀ´Ôö¼ÓCÅ̿ռ䡣
1.´ò¿ª“ÎҵĵçÄÔ”-“¹¤¾ß”-“Îļþ¼ÐÑ¡Ïî”-“²é¿´”-ÔÚ“ÏÔʾËùÓÐÎļþºÍÎļþ¼Ð”Ñ¡Ïîǰ´ò¹´-“È·¶¨”
2.ɾ³ýÒÔÏÂÎļþ¼ÐÖеÄÄÚÈÝ:
x:\ ......
1¡¢Òþʽת»»
CÔÚÒÔÏÂËÄÖÖÇé¿öÏÂ»á½øÐÐÒþʽת»»:
1¡¢ËãÊõÔËËãʽÖУ¬µÍÀàÐÍÄܹ»×ª»»Îª¸ßÀàÐÍ¡£
2¡¢¸³Öµ±í´ïʽÖУ¬Óұ߱í´ïʽµÄÖµ×Ô¶¯Òþʽת»»Îª×ó±ß±äÁ¿µÄÀàÐÍ£¬²¢¸³Öµ¸øËû¡£
& ......
Visual C#ÊÇ΢Èí¹«Ë¾ÍÆ³öµÄÐÂÒ»´ú³ÌÐò¿ª·¢ÓïÑÔ£¬ÊÇ΢Èí.Net¿ò¼ÜÖеÄÒ»¸öÖØÒª×é³É²¿·Ö¡£ÆÁÄ»±£»¤³ÌÐòÊÇÒÔscrΪÀ©Õ¹ÃûµÄ±ê×¼Windows¿ÉÖ´ÐгÌÐò¡£ÆÁÄ»±£»¤³ÌÐò²»½ö¿ÉÒÔÑÓ³¤ÏÔʾÆ÷µÄʹÓÃÊÙÃü£¬»¹¿ÉÒÔ±£»¤Ë½ÈËÐÅÏ¢¡£±¾ÎÄÏò´ó¼Ò½éÉÜÒ»¸ö.Netƽ̨ÉÏÓÃC#±àдµÄÒ»¸ö¶¯Ì¬Îı¾¼°Í¼ÐÎµÄÆÁÄ»±£»¤³ÌÐò¡£
¡¡¡¡Ò»¡¢¾ßÌåʵÏÖ²½Ö裺
¡¡¡¡£ ......
#include<stdlib.h>
#include<iostream>
#include<string.h>
using namespace std;
int main(void)
{
FILE *fp, *fp2;
char buf[1024*300];
fp = fopen("in.txt", "rb");
fp2 = fopen("out.txt", "wb+");
fseek(fp, 0, SEEK_END);
int iLen ......