l16.2a
来自「<B>Digital的Unix操作系统VAX 4.2源码</B>」· 2A 代码 · 共 55 行
2A
55 行
#printWrite a program which reads a file with lines of upto 200 characters and shortens them to 60 charactersby throwing away any characters past the first 60.Compile and test it; then type "ready".#once #create Refhoboken harrison newark roseville avenue grove streeteast orange brick church orange highland avenue east orange mountain station south orange maplewood millburn short hillssummit chatham madison convent station morristown summit chanew providence murray hill berkeley heightsgillette stirling millingon lyons basking ridgexxxxxxxxxxxxxbernardsville far hills peapack gladstone#once #create badinhoboken harrison newark roseville avenue grove streeteast orange brick church orange highland avenue east orange brick church orange highland avenue east orange brick church orange highland avenuemountain station south orange maplewood millburn short hillssummit chatham madison convent station morristown summit chatham madison convent station morristown summit chatham madison convent station morristownnew providence murray hill berkeley heightsgillette stirling millingon lyons basking ridgexxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxbernardsville far hills peapack gladstone#usera.out <badin >xxx#cmp Ref xxx#succeed/* one way to do this */ #include <stdio.h>main(){ char line[61]; int c, k; k = 0; while ((c = getchar()) != EOF) { if (c == '\n') { line[k] = 0; printf("%s\n", line); k = 0; } else if (k < 60) line[k++] = c; }}/* Note that this version works regardless ofhow long the lines are. If you use getline,is the same thing true?? */#log#next16.2b 10
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?