我看到人们最近在很多帖子中试图读取这样的文件.
码
#include <stdio.h>
#include <stdlib.h>
int
main(int argc, char **argv)
{
char *path = argc > 1 ? argv[1] : "input.txt";
FILE *fp = fopen(path, "r");
if( fp == NULL ) {
perror(path);
return EXIT_FAILURE;
}
while( !feof(fp) ) { /* THIS IS WRONG */
/* Read and process data from file… */
}
if( fclose(fp) == 0 ) {
return EXIT_SUCCESS;
} else {
perror(path);
return EXIT_FAILURE;
}
}
Run Code Online (Sandbox Code Playgroud)
这个__CODE__循环有什么问题?
我们在Team Foundation Server(TFS)中有一个项目,其中包含非英语字符(š).当我试图编写一些与构建相关的东西时,我们偶然发现了一个问题 - 我们无法将š字母传递给命令行工具.命令提示符或其他什么不是搞砸了,并且tf.exe实用程序找不到指定的项目.
我已经尝试了.bat文件的不同格式(ANSI,带有和不带BOM的 UTF-8 )以及用JavaScript编写脚本(这本身就是Unicode) - 但没有运气.如何执行程序并将其传递给Unicode命令行?