CµÄTXTµç×ÓÊéÔĶÁÆ÷£¨DOS£©
¿ÉϧMS-DOS²»ÊÇÖйúÈËдµÄ£¬²»Ö§³ÖÖÐÎÄ¡£
/* Note:Your choice is C IDE */
#include "stdio.h"
main(int argc, char *argv[])
{
FILE *fp;
char ch;
int num=0,max;
int line=0;
if((fp=fopen(argv[1],"rt"))==NULL)
{
printf("\nCannot open file strike any key exit!");
getch();
exit(1);
}
while(ch!=EOF)
{
if(wherex()==1) {num++;printf("%d: ",num);}
putchar(ch);
ch=fgetc(fp);
}
max=num;
num=0;
fclose(fp);
while(1)
{
num=0;
fp=fopen(argv[1],"rt");
ch=fgetc(fp);
while(ch!=EOF)
{
if(wherex()==1) {num++;printf("%d: ",num);}
if(num==line+24) break;
putchar(ch);
ch=fgetc(fp);
}
printf("Which line do you want going to?(Most %d)",max);
scanf("%d",&line);
if(line<=0) exit(1);
}
}
Ïà¹ØÎĵµ£º
Ò»°ãÎÒÃǵ÷ÓÃshell½Å±¾¶¼ÓÃsystem()À´ÊµÏÖ£¬È»ºó·¢ÏÖsytem·µ»ØÖµ²»ºÃ¿ØÖƶøÇÒת»»Âé·³(»¹ÒªÓÒÒÆ4λ¼´/256)£¬ÓÚÊÇÎÒÓÃpopenÀ´»ñÈ¡shellµÄ·µ»ØÖµ¡£¹ûÈ»ÔÚUnixÊÀ½çÀïÃ棬ͨµÀ¾ÍÊÇÁ¬½á¸÷¸ö·½ÃæµÄÇÅÁº°¡£¡
´úÂëÀý×ÓÈçÏ£º
#include<stdio.h>
#include<stdlib.h>
#include<sys/wait.h>
int main (int argc ......
4.2 ¶à½Ç¶È±£Ö¤²âÊÔЧ¹û
¶ÔÓÚ´úÂëÖÊÁ¿ÒªÇóºÜ¸ßµÄÏîÄ¿À´Ëµ£¬½öÓа׺и²¸ÇÊÇÔ¶Ô¶²»¹»µÄ¡£°×ºÐ¸²¸Ç²»ÄÜ·¢ÏÖ´úÂëȱʧ£¬°×ºÐ¸²¸Ç»ùÓÚÏÖÓдúÂ룬Èç¹û´úÂë²»´æÔÚ£¬µ±È»²»ÄÜ·¢ÏÖ¡£ÎªÁ˼ì²â´úÂëȱʧ£¬ÐèÒªÈ˹¤¶Ô²âÊÔÊý¾Ý½øÐмì²é¡£°×ºÐ¸²¸ÇÒ²²»ÄÜ·¢ÏÖÓÃÀýδ·´Ó³¹¦ÄÜ¡£Èç¹ûÉè¼ÆÓÃÀýʱ£¬²âÊÔÔ±²»Á˽â´úÂëµÄ¹¦ÄÜ£¬Í ......
1. CµÄʵÏÖ
//stack.h
#ifndef STACK_H
#define STACK_H
#define STACK_CAPACITY 20//maximum size of stack
typedef int stackEle;
typedef struct
{
stackEle myArray[ STACK_CAPACITY ];
int myTop;
}stack;
//construct(initialize) an empty stack
stack *stack_init(void);
//return 1 if stack is em ......
GDB
ÊÇ
GNU
¿ªÔ´×éÖ¯·¢²¼µÄÒ»¸öÇ¿´óµÄ
UNIX
ϵijÌÐòµ÷ÊÔ¹¤¾ß¡£»òÐí£¬¸÷λ±È½Ïϲ»¶ÄÇÖÖͼÐνçÃ淽ʽµÄ£¬Ïñ
VC
¡¢
BCB
µÈ
IDE
µÄµ÷ÊÔ£¬µ«Èç¹ûÄãÊÇÔÚ
UNIX
ƽ̨ÏÂ×öÈí¼þ£¬Äã»á·¢ÏÖ
GDB
Õâ¸öµ÷ÊÔ¹¤¾ßÓбÈ
VC
¡¢
BCB
µÄͼÐλ¯µ÷ÊÔÆ÷¸üÇ¿´óµÄ¹¦ÄÜ¡£Ëùν
“
´çÓÐËù³¤£¬³ßÓÐËù¶Ì
”
¾ÍÊÇÕâ¸öµÀÀí ......