查看完整版本: [-- [古董]找到一些 Turbo C 的源程序 --]

【 浮游城 - Castle in the Sky | 开放邀请注册,PS|SS|WII|DC下载研究中心 】 -> 【 电脑全方位 | Computer All Round 】 -> [古董]找到一些 Turbo C 的源程序 [打印本页] 登录 -> 注册 -> 回复主题 -> 发表主题

永恒の翼 2005-01-29 22:44

第一个是,提取 DOS 版仙剑 MIDI 音乐的,原来骗过稿费的东西

代码

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
char TargetFileName[32]="PAL_00.mid";
void main(void)
{
FILE *SourceFile,*TargetFile;
long Start,End,Len;
int i,j,k,file;
file=0;
clrscr();
gotoxy (18,10);
printf ("PAL Music Maker, Made by Ashuro. Date:2000/12/21\n");
if ((SourceFile=fopen ("MIDI.MKF"),"rb")=NULL)
  {
   gotoxy (21,13);
   printf ("Can not find MIDI.MKF\n");
   exit(1);
  }
for (i=1;i<87;i++)
   {
    fseek (SourceFile,1*4,SEEK_SET);
    fread (&Start,1,4,SourceFile);
    fread (&End,1,4,SourceFile);
    fseek (SourceFile,Start,SEEK_SET);
    Len=End-Start;
    if (len>0)
      {
     ++file;
     TargetFileName[6]=(file/10)+'0';
     TargetFileName[7]=(file%10)+'0';
     TargetFile=fopen (TargetFileName,"wb");
     gotoxy (23,13);
     printf ("Now Saving %d music: %s",file,TargetFileName);
     for (j=0;j<len;j++)
   {
    k=fgetc (SourceFile);
    fputc (k,TargetFile);
   }
     fclose (TargetFile);
      }
   }
fclose (SourceFile);
gotoxy (29,15);
printf ("Music has all saved successfully.\n");
}

永恒の翼 2005-01-29 22:47
从一张软盘里找出来的,里面居然发现了TC2、MASM宏汇编和FOX,寒啊

第二个我也不知道是什么东东,可能和股票卡或者软件有关吧
代码

#include <stdlib.h>
#include <stdio.h>
main()
{
char systempath,mlpath,slpath;
int i;
printf ("This is the stock system tool for Slon & Winner Pro II\n");
printf ("Please Enter your system Path:\n");
scanf ("%s",systempath);
printf (" Winner Pro II Path:");
scanf ("%s",mlpath);
printf ("\nSlon Path:);
scanf ("%s",slpath);
printf ("Winner Pro II & SLON System Repair Tools\n\n\n");
printf ("     1. ML30 System Data Tool\n");
printf ("     2. ML30 System Reset For GMX Card\n");
printf ("     3. ML30 System Min Data Remove\n");
printf ("     4. ML30 System Old Info File Clean\n");
printf ("     5. Convert ML30 Data to SLON \n");
printf ("     6. SLON System Data Tool\n");
printf ("     7. SLON System Min Data Remove\n");
printf ("     8. Quit This Repair System\n\n");
printf ("Please Enter a choice:");
scanf ("%d",&i);
}
switch (i);
{
case 1:mltool();break;
case 2:mlreset();break;
case 3:mlremove();break;
case 4:mlinfo();break;
case 5:convert();break;
case 6:sltool();break;
case 7:slremove();break;
case 8:exit(0);break;
default:main();
}

void mltool()
{
system ("%s\\data\\pcdm.exe",mlpath);
}

void mlreset()
{
system ("call %s\\reset.bat",mlpath);
}

void mlremove()
{
system ("%s\\deltree /y %s\\data\shase\\min",systempath,mlpath);
system ("%s\\deltree /y %s\\data\sznse\\min",systempath,mlpath);
system ("%s\\deltree /y %s\\data\lond\\dat\\*.*",systempath,mlpath);
}

void mlinfo()
{
system ("%s\\deltree /y %s\\data\\shase\\base",systempath,mlpath);
system ("%s\\deltree /y %s\\data\\sznse\\base",systempath,mlpath);
}

void convert()
{
FILE *fp;
if ((fp=fopen("lonpath.cfg","w"))==NULL
{printf ("File lonpath.cfg not found !!!!");
exit(1);
fprintf (fp,"%s%*c",mlpath);
fclose(fp)
system ("%s\\ml2sl.exe",slpath);
}

永恒の翼 2005-01-29 22:48
这个要注意点了,删除文件用的程序,不论属性,仅仅在当前目录中有效。

代码

#include <stdio.h>
#include <process.h>
#include <dos.h>
main()  /*主函数*/
{
char filename[12];
printf ("请输入你想删除的文件的路径和名称:");
gets (filename);     /*从键盘读入文件名*/
attrib (filename);   /*调用文件属性函数*/
delete (filename);   /*调用文件删除函数*/
printf ("指定文件已经删除!\n");
}

attrib (char near *file) /*改变文件属性的函数*/
{
union REGS inregs,outregs;
struct SREGS segregs;
inregs.h.ah=0x43;
inregs.h.al=1;
inregs.h.cl=FA_ARCH;
segregs.ds=FP_SEG(file);
inregs.x.dx=FP_OFF(file);
int86x(0x21,&inregs,&outregs,&segregs);  /*设置文件属性为归档*/
return;
}

delete (char near *file)  /*删除文件的函数*/
{
union REGS inregs,outregs;
struct SREGS segregs;
inregs.h.ah=0x41;
inregs.x.dx=FP_OFF(file);
segregs.ds=FP_SEG(file);
int86x(0x21,&inregs,&outregs,&segregs);/*调用DOS函数中删除文件值*/
return;
}

永恒の翼 2005-01-29 22:50
最后一个更可怕,好管用,删除当前盘下的指定名称的文件,不论属性,自动历遍目录树,仅未测试隐藏目录,估计有效。

请注意不要使用通配符,否则后果自负

代码

#include <stdio.h>
#include <stdlib.h>
#include <dos.h>
#include <dir.h>
#include <string.h>
struct ffblk f,ff;
int i,j,node,done;
char dir[100][MAXDIR],file[50];
char mid[MAXDIR],curr[MAXDIR];
repeat();
delpro();
int main(int argc,char *argv[]) /*main program*/
{
if (argc!=2)
 {
  printf ("\n Warning:\n");
  printf ("\t   This program will NOT prompt you to choice YES or NO,\n");
  printf ("\t you must decide to delete the file(s).\n\n");
  printf ("Usage: delall <filename> \n");
  printf ("\t   This program supports * and ? \n");
  exit (0);
 }
strcpy (file,argv[1]);
strupr (file);
getcwd (curr,MAXDIR);
i=1;j=0;
system ("cd\\");
getcwd (dir[i],MAXDIR);
printf ("Now browsing %s in the Directory(ies)...\n",file);
repeat();
}
repeat() /*browse the directory*/
{
getcwd (mid,MAXDIR);
delpro();
done=findfirst("*.*",&ff,FA_DIREC|FA_SYSTEM|FA_HIDDEN|FA_ARCH|FA_RDONLY);
while (!done)
{
 if (((ff.ff_attrib & 0xf0)==16) && strcmp(ff.ff_name,".") && strcmp(ff.ff_name,".."))
  {
   i=i+1;
   if (strlen(mid)==3)
    {
     strcpy (dir[i],mid);
     strcat (dir[i],ff.ff_name);
    }
 else
    {
     strcpy (dir[i],mid);
     strcat (dir[i],"\\");
     strcat (dir[i],ff.ff_name);
    }
   }
 done=findnext(&ff);
}
if (i==1)
{
 chdir (curr);
 if (j==0)
 printf ("Can not find the file(s)!\n");
 else printf ("Deleted %d file(s).",j);
 exit (0);
}
chdir (dir[i]);
i--;
repeat();
}
delpro() /*delete function*/
{
node=findfirst(file,&f,FA_RDONLY|FA_HIDDEN|FA_SYSTEM|FA_ARCH);
while (!node)
 {
  unlink (f.ff_name);
  j=j+1;
  printf ("Deleting %s, The Directory is %s .\n",f.ff_name,mid);
  node=findnext(&f);
 }
}

永恒の翼 2005-01-29 22:52
最后感叹一句,把这些东西基本全还给老师了……

现在叫我看都差点看不懂了……
不敢相信这是我原来搞的东西……

心太 2005-01-29 23:38
我现在硬盘上就有TC2.0,FOXBASE,Foxpro for DOS,MASM,QBASIC,PASCAL6.0

Silmeria 2005-01-30 08:33
回去研究研究,刚开始学C。

lBlack 2005-01-30 14:32
哈哈,虽然2年没碰过了,前几天还在CV上大言不惭地写上:
Programming knowledge

Area Level Last used Experience
MySQL Advanced Currently in use 4 years
Apache Advanced Currently in use 4 years
C/C++ Average Currently in use 6 years
PHP Advanced Currently in use 2 years
Perl Advanced Currently in use 2 years
HTML Advanced Currently in use 6 years
DHTML Advanced Currently in use 4 years
Javascript Advanced Currently in use 4 years
ASP Average 1 year ago 5 years
Oracle Average 1 year ago 1 year
Java Average 1 year ago 1 year
Unix/Linux Average Currently in use 5 years
Windows Advanced Currently in use 10 years

Harlay 2005-01-31 13:46
一个问题。
能够在win98下删除win386.swp或在winxp下删除pagefile.sys文件吗?

永恒の翼 2005-01-31 16:02
引用 (Harlay @ 2005-01-31 13:46:16)
一个问题。
能够在win98下删除win386.swp或在winxp下删除pagefile.sys文件吗?

…………那些个都是WINDOWS虚拟内存文件,有一个办法,不需要删除也能消失

你用1G以上的内存,直接禁用虚拟内存使用就OK了……


WIN98呢就在SYSTEM.ini文件中的[386Enh]段后面加上下面2句:

ConservativeSwapfileUsage=1
Paging=off

Harlay 2005-01-31 16:50
引用 (Dark Angel @ 2005-01-31 16:02:36)
引用 (Harlay @ 2005-01-31 13:46:16)
一个问题。
能够在win98下删除win386.swp或在winxp下删除pagefile.sys文件吗?

…………那些个都是WINDOWS虚拟内存文件,有一个办法,不需要删除也能消失

你用1G以上的内存,直接禁用虚拟内存使用就OK了……


WIN98呢就在SYSTEM.ini文件中的[386Enh]段后面加上下面2句:

ConservativeSwapfileUsage=1
Paging=off

表转移话题。
请正面回答偶滴问题。em32.gif


查看完整版本: [-- [古董]找到一些 Turbo C 的源程序 --] [-- top --]


Powered by PHPWind Code © 2003-08 PHPWind
Gzip enabled

You can contact us