/* Print lines with length larger than PRINTLENGTH */
int main() {
	int length;									/* Length of the current line */
	char line[MAXLINE];					/* Current line */

	while ( (length = getlinelength( line, MAXLINE )) > 0 )
		if ( length > PRINTLENGTH ) 
			printf("Larger than %d: %s", PRINTLENGTH, line);
}
예제 #2
0
파일: editor.c 프로젝트: cyy0523xc/r-source
static void editorrunline(textbox t)
{
    int length = getlinelength(t); /* return character num */
    char *line = malloc(length * sizeof(WCHAR) + 2); /* Extra space for null and word length in getcurrentline */
    memset(line, 0, length * sizeof(WCHAR) + 2);
    getcurrentline(t, line, length);
    consolecmd(RConsole, line);
    free(line);
    scrollcaret(t, 1);
    show(t);
}
/* trimstr: eliminate trailing blanks of an input line and return the length */
int trimstr(char line[], int limit) {
	int length = getlinelength(line, limit);
	return removetrailingspaces(line, length);
}