你的文件还没有打开呢
如: fileopen(hfile,fmOpenWrite)

解决方案 »

  1.   

    append(hfile) 或 rewrite(hfile),就已经打开了文件了!
      

  2.   

    最好再 TRY TRY ...^u^p^
      

  3.   

    Assignfile(hfile,'f:\wp.txt');
      try
      if fileexists('f:\wp.txt') then
        append(hfile)
      else
            rewrite(hfile);
      finally
        closefile (hfile);
      end;
      

  4.   

    程序肯定没问题,是不是系统有问题,我加了TRY也不行,
    还有:F:\是有操作权限的.
      

  5.   

    这一段代码你是不是执行了2次以上?(我想一定是的)
    Assignfile(hfile,'f:\wp.txt');
          if fileexists('f:\wp.txt') then
            append(hfile)
          else
            rewrite(hfile);
    第一遍Append函数使文件进入添加模式,然后你在没有关闭文件的情况下又调用
    Append,是不是?所以就出错了。记得该关闭时一定要关闭文件!!
    ------------------------------------------------------------------------
    superyiman(役满)的代码时正确的
      

  6.   

    FileName:='f:\wp.txt';if FileExists(FileName) then
      Begin
        Assignfile(hfile,FileName);
        Append(HFile);//Call Append to ensure that a file is opened with write-only 
                      //access with the file pointer positioned at the end of 
                      //the file.
        Writeln(HFile, 'appended text');
        ...
        CloseFile(HFile); //Close file, save changes    
      End  
    else
      Begin
        Assignfile(hfile,FileName);
        FileMode:=1;// write only
        ReWrite(HFile);
        Writeln(HFile, 'appended text');
        ...
        CloseFile(HFile); //Close file, save changes 
      End;  
          if fileexists('f:\wp.txt') then
                  else
            rewrite(hfile);
          为什么一执行到 Append 句 或 Rewrite 句,就会出错 I/O 32
     
     
      

  7.   

    你的程序可以通过编译吗?!Delphi中Windows单元定义了 HFILE = LongWord!
    所以把你程序中HFILE都改为myfile就正常了
      

  8.   

    不知道你的程序hfile变量是怎么定义的,
    要是还有问题,请把你的程序发到[email protected],我好好帮你看看.
      

  9.   

    我遇到过
        if not FileExists(filename) then
          rewrite(fp)     
        else
          reset(fp);//呵呵,你只记得rewrite,却忘了reset
    append(fp);