?? file.c
字號(hào):
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include "lithos.h"
static char token[256];
static int readChar(FILE *f)
{
int c = fgetc(f);
if (feof(f))
{
printf("Unexpected end of file\n");
exit(EXIT_FAILURE);
}
return c;
}
static void readComment(FILE *f)
{
int c;
do
c = readChar(f);
while (c != ']');
}
static void readToken(FILE *f)
{
int c;
int i = 0;
do
{
c = readChar(f);
if (c == '[')
readComment(f);
}
while (isspace(c) || c == '[');
do
{
token[i++] = c;
c = readChar(f);
}
while (isalpha(c) || isdigit(c) || c == '-');
if (c == '[')
readComment(f);
token[i] = 0;
}
char *readString(FILE *f)
{
readToken(f);
return token;
}
int readInt(FILE *f)
{
readToken(f);
return atoi(token);
}
void writeString(FILE *f, char *s)
{
fprintf(f, "%s", s);
}
void writeInt(FILE *f, int n)
{
fprintf(f, "%d", n);
}
void writeCommentedInt(FILE *f, char *comment, int n)
{
int i;
fputc('[', f);
writeString(f, comment);
fputc(']', f);
for (i = 22 - strlen(comment); i > 0; i--)
fputc(' ', f);
writeInt(f, n);
fputc('\n', f);
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -