Re: how to design an testing example



Hi,

While passing the file name use "\\" insted of "\".

Best Regards,
Subra..
qazwsx746@xxxxxxxx wrote:
The content of my program are the following:

#include <stdio.h>
int main(int argc,char *argv[])
{ FILE *fp;
void filecopy(FILE *,FILE *);
if (argc==1)
filecopy(stdin,stdout);
else
while (--argc>0)
if ((fp=fopen(*++argv,"r"))==NULL) {
printf("cat:can't open %s\n",*argv);
return 1;
} else {
filecopy(fp,stdout);
fclose(fp);
}
return 0;
}
void filecopy(FILE *ifp,FILE *ofp)
{int c;
while ((c=getc(ifp))!=EOF)
putc(c,ofp);
}
when I input command lines,for example:cat f:\test\1.cpp (windows xp
is installed in my computer)
the output are :cat f:\test\1.cpp
The angrument which is f:\test\1.cpp donot have work,and output is cat
f:\test\1.cpp
I know the program have no problem.
But I can't run the program corretly?
What should I do?

.



Relevant Pages

  • Help in Java swings(internal Frame)
    ... public int getSize() ... public void valueChanged{ ... private JScrollPane scrollPane1; ... public class PeakContainer extends JInternalFrame ...
    (comp.lang.java.programmer)
  • [PATCH] get rid if __cpuinit and __cpuexit
    ... unsigned long action, void *hcpu) ... unsigned int cpu = hcpu; ... -static int __cpuinit ... __cpu_up(unsigned int cpu) ...
    (Linux-Kernel)
  • [PATCH,RFC 2.6.14 09/15] KGDB: SuperH-specific changes
    ... This adds basic support for KGDB on SuperH as well as adding some architecture ... -static int kgdb_uart_getchar ... -static void kgdb_uart_putchar ... * The command-line option can include a serial port specification ...
    (Linux-Kernel)
  • problem in java swings
    ... public int getSize() ... public void valueChanged{ ... private JScrollPane scrollPane1; ... public class PeakContainer extends JInternalFrame ...
    (comp.lang.java.programmer)
  • ToolTips in a View and TTN_NEEDTEXT
    ... extern int g_minWorkPeriod; ... void CDayView::CreateAllFonts ... void CDayView::DrawDayLog(CDC* pDC) ... BOOL CDayView::TimeToY ...
    (microsoft.public.vc.mfc)