strtok 기능은 끈에 있는 다음 토큰을 찾아내는 이용된다. 토큰은 가능한 구분짖는 기호의 명부에 의해 지정된다. 뒤에 오는 보기는 파일에서 텍스트 행을 읽고 구분짖는 기호, 공간, 탭 및 새로운 구간을 사용하여 낱말을 결정한다.

Files Recovery Software
연락처 세부 정보 고객 지원 다운로드 데모 제품  

 
 

strtok 기능

strtok 기능은 끈에 있는 다음 토큰을 찾아내는 이용된다. 토큰은 가능한 구분짖는 기호의 명부에 의해 지정된다.

뒤에 오는 보기는 파일에서 텍스트 행을 읽고 구분짖는 기호, 공간, 탭 및 새로운 구간을 사용하여 낱말을 결정한다. 각 낱말은 개별 회선에 그 때 표시된다:

#include <stdio.h>
#include <string.h>

int main()
{
FILE *in;
char line[80];
char *delimiters = " \t\n";
char *token;

if ((in = fopen("C:\\text.txt", "r")) == NULL)
{
puts("Unable to open the input file");
return 0;
}

/* Read each line one at a time */
while(!feof(in))
{
/* Get one line */
fgets(line, 80, in);

if (!feof(in))
{
/* Break the line up into words */
token = strtok(line, delimiters);

while (token != NULL)
{
puts(token);
/* Get the next word */
token = strtok(NULL, delimiters);
}
}
}
fclose(in);
return 0;
}

프로그램의 위 그것은, 에서 = ("C:\ \ text.txt", "r") fopen, 그리고 기존 파일 C:\ \ text.txt 연다. 지정된 경로에서 또는 어떤 이유도를 위해 존재하지 않는 경우에, 파일은 스크린에, 착오 알림말 표시된다 열릴 수 없었다.

어떤을의 이 기능 사용하는 뒤에 오는 보기를 고려하십시오:

#include <stdio.h>
#include <string.h>

void main()
{
char line[100], *sub_text;

/* initialize string */
strcpy(line,"hello, I am a string;");

printf("Line: %s\n", line);

/* add to end of string */
strcat(line," what are you?");

printf("Line: %s\n", line);


/* find length of string */
/* strlen brings back */
/* length as type size_t */

printf("Length of line: %d\n", (int)strlen(line));

/* find occurence of substrings */
if ( (sub_text = strchr ( line, 'W' ) )!= NULL )

printf("String starting with \"W\" ->%s\n",
sub_text);

if ( ( sub_text = strchr ( line, 'w' ) )!= NULL )

printf("String starting with \"w\" ->%s\n",
sub_text);

if ( ( sub_text = strchr ( sub_text, 'u' ) )!= NULL )
printf("String starting with \"w\" ->%s\n",
sub_text);

}

프로그램의 산출은 다음과 같이 표시될 것이다:

Line: hello, I am a string;
Line: hello, I am a string; what are you?
Length of line: 35
String starting with "w" ->what are you?
String starting with "w" ->u?

 


Previous page

page 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18

 
 

page 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34

 
 

page 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50

 
 

page 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60

Next page
 
 
데이터 복구 도서
 
장-1 자료 회복의 개관
장-2 하드 디스크의 소개
장-3 디스크와 OS에 논리적인 접근
장-4 수 체계
장-5 C 프로그램의 소개
장-6 컴퓨터 기초에 소개
장-7 필요한 DOS는 명령한다
장-8 디스크 BIOS는 작용하고 C로 취급을 중단한다
장-9 큰 하드 디스크 취급
장-10 타락된 플로피에서 자료 회복
장-11 백업을 만들기
장-12 프로그램을 가진 읽고는 및 변경 MBR
장-13 프로그램을 가진 읽고는 및 변경 DBR
장-14 "익지않는 파일" 회복을 위해 프로그램
장-15 자료 와이퍼를 위해 프로그램
장-16 디스크를 위한 공용품 더 개발
부록 자료 회복 기간의 용어집
 
 
Pro Data Doctor

제품

연락처 세부 정보

고객 지원

다운로드 데모

이용 약관

 
Pro Data Doctor