易截截图软件、单文件、免安装、纯绿色、仅160KB

c primer plus 一道练习题,求助 - C/C++ / C语言

题目是:编写一段程序,依次在屏幕上显示命令行中列出的所有文件。使用argc控制循环
(Write a program that sequentially displays onscreen all the files listed in the command line. Use argc to control a loop.)
几乎是照抄网上的练习源代码,但结果是错的
C/C++ code:
1 #include <stdio.h>
2 #include <stdlib.h>
3
4
5 int main(int argc,char *argv[])
6 {
7 int byte;
8 FILE *source;
9 int filect;
10
11 if(argc==1)
12 {
13 printf("Usage: %s filename[s]\n",argv[0]);
14 exit(EXIT_FAILURE);
15 }
16
17 for(filect=1;filect<argv;filect++)
18 {
19 if((source=fopen(argv[filect],"r"))==NULL)
20 {
21 printf("Counld not open file %s for input\n",argv[filect]);
22 continue;
23 }
24
25 while((byte==getc(source))!=EOF)
26 {
27 putchar(byte);
28 // putc(byte,stdout);
29 }
30
31 if(fclose(source)!=0)
32 {
33 printf("Counld not close file %s\n",argv[1]);
34 }
35 }
36 return 0;



ubuntu下运行结果为
C/C++ code
��������������ʏ


相关问答:

execl怎么调用java程序 - C/C++ / C语言

如题,C/C++中的execl怎么调用写好的java程序,
execl("/opt/java1.5/bin/java","MyClass",NULL);
这样的不行哦。

不会.

运行java程序
找工具查看一下那个程序的命令行

搜索下:jni ......

C/S项目架构设计----求助 - Java / Java SE

本人正在用Java做一个C/S架构的项目, 
可是由于项目比较大,前期对架构的设计尤其重要,因为后期可能随时会加个功能或者去掉某些功能。 
所以特地寻求如何设计C/S的架构使程序更加面向对象更加易于维 ......

c静态编译另一个文件夹的库函数 - C/C++ / C语言

在根目录/lib中存放一个log.c,log.h,并用下面的语句:
gcc -c log.c
ar crv liblog.a log.o
编译出一个liblog.a静态库,然后在文件夹:/testfile中创建一个test.c和testc.c,test.c中引用了testc.c中定义的方法 ......

求助:C代码改写成VB代码 - VB / 基础类

谁能帮我把下面这些代码改成VB形式的,多谢了,急用~~
#include "stdlib.h"
#include "math.h"
#include "stdio.h"
float objfx(float x[]);
void constraint(float x[],float g ......

求助:C代码change toVB代码 - VB / 基础类

挺繁琐,之前发的帖子,分值太低现在重发一个。欢迎各位大侠~~
#include "stdlib.h"
#include "math.h"
#include "stdio.h"
float objfx(float x[]);
void constraint(float x[] ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号