• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ IoErr函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中IoErr函数的典型用法代码示例。如果您正苦于以下问题:C++ IoErr函数的具体用法?C++ IoErr怎么用?C++ IoErr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了IoErr函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: AllocMem

struct DosList *MyMakeDosEntry(struct Handler *handler, const TEXT *name, LONG type)
{
   struct DosList *entry;
   LONG error = 0;

   entry = AllocMem(sizeof(struct DosList), MEMF_CLEAR | MEMF_PUBLIC);

   if(entry != NULL)
   {
      if(!MyRenameDosEntry(handler, entry, name))
         error = IoErr();
      entry->dol_Type = type;
   }
   else
      error = IoErr();

   if(error != 0)
   {
      MyFreeDosEntry(handler, entry);
      entry = NULL;
   }

   SetIoErr(error);
   return entry;
}
开发者ID:michalsc,项目名称:AROS,代码行数:25,代码来源:support.c


示例2: main

int main()
{
    LONG result = 0;
    LONG ioerr = 0;
    TEXT buffer[16];

    fh = Open("T:a", MODE_NEWFILE);

    /* Invalid parameters */
    SetIoErr(0);
    result = FRead(fh, buffer, 0, 0);
    ioerr = IoErr();
    TEST((result == 0));
    TEST((ioerr == 0));

    /* EOF */
    SetIoErr(0);
    result = FRead(fh, buffer, 1, 1);
    ioerr = IoErr();
    TEST((result == 0));
    TEST((ioerr == 0));

    /* BNULL file handle */
    SetIoErr(0);
    result = FRead(BNULL, buffer, 1, 1);
    ioerr = IoErr();
    TEST((result == 0));
    TEST((ioerr == 0));

    cleanup();

    return OK;
}
开发者ID:michalsc,项目名称:AROS,代码行数:33,代码来源:fread.c


示例3: main

int main(void) {
  ARP2_SysCallBase = OpenResource(ARP2_SYSCALL_NAME);

  if (ARP2_SysCallBase != NULL) {
    LONG fd = arp2sys_open("/etc/passwd", O_RDONLY, 0);
    PrintFault(IoErr(), "arp2sys_open");
    Printf("Opened file %ld\n", fd);

    if (fd != -1) {
      char buf[512];

      LONG count = arp2sys_read(fd, buf, sizeof (buf) - 1);
      buf[511] = 0;

      PrintFault(IoErr(), "arp2sys_read");
      Printf("Read %ld bytes.\n", count);
      PutStr(buf);
      PutStr("\n");
    }

    arp2sys_close(fd);
    PrintFault(IoErr(), "arp2sys_close");
    Printf("Closed file %ld\n", fd);
  }

  return 0;
}
开发者ID:BackupTheBerlios,项目名称:arp2-svn,代码行数:27,代码来源:arp2sys-test.c


示例4: my_rename

/******************************************************************
 * my_rename
 ******************************************************************/
int my_rename (const TCHAR *oldname, const TCHAR *newname) {

  LONG res;
	char cmd[255];

  DebOut("oldname: %s newname %s\n", oldname, newname);

  res=Rename(oldname, newname);

  if(res==DOSTRUE) {
    return 0;
  }

  /* ugly hack, as windows rename can move over filesystem borders,
	 * but AROS rename can't. And there seems to be no simple
	 * API to move a file across filesystem borders...
	 * So we use the shell and hope for the best..
	 */
	DebOut("rename failed, try shell copy..\n");
	sprintf(cmd, "c:copy from %s to %s MOVE QUIET >NIL:", oldname, newname);

	DebOut("execute: %s\n", cmd);
	Execute(cmd, NULL, NULL);

	if(fsdb_exists(newname)) {
    /* there is a file, pray, it is the one we copied ;) */
		return 0;
  }

  SetLastError(IoErr());
  DebOut("return -1 (%d)\n", IoErr());
  return -1;
}
开发者ID:Kalamatee,项目名称:WinUAE,代码行数:36,代码来源:fsdb_aros.cpp


示例5: main

void main(void)
{
  struct AHIAudioModeRequester *req;
  BOOL res;

  if(AHImp=CreateMsgPort())
    if(AHIio=(struct AHIRequest *)CreateIORequest(AHImp,sizeof(struct AHIRequest))) {
      AHIio->ahir_Version = 2;
      AHIDevice=OpenDevice(AHINAME,AHI_NO_UNIT,(struct IORequest *)AHIio,NULL);
      }

  if(AHIDevice) {
    Printf("Unable to open %s version 2\n",AHINAME);
    cleanup(RETURN_FAIL);
  }
  AHIBase=(struct Library *)AHIio->ahir_Std.io_Device;

  req=AHI_AllocAudioRequest(
      AHIR_SleepWindow,TRUE,
      AHIR_UserData,999,
      AHIR_PubScreenName,NULL,
      TAG_DONE);

  res=AHI_AudioRequest(req,
      AHIR_TitleText,       "Select a mode or cancel",
      AHIR_NegativeText,    "Abort",
      AHIR_DoMixFreq,       TRUE,
      AHIR_DoDefaultMode,   TRUE,
      AHIR_InitialAudioID,  0x20003,
      AHIR_InitialMixFreq,  30000,
      AHIR_FilterTags,      ReqFilterTags,
      TAG_DONE);

  if(!res)
  {
    if(IoErr() == ERROR_NO_FREE_STORE)
      Printf("AHI ran out of memory!\n");
    else if(IoErr() == ERROR_NO_MORE_ENTRIES)
      Printf("No available modes!\n");
    else
     Printf("Requester cancelled!\n");
  }
  else
    Printf("Selected AudioMode: 0x%08lx, %ld Hz\n",req->ahiam_AudioID,req->ahiam_MixFreq);

  AHI_FreeAudioRequest(req);

  cleanup(RETURN_OK);
}
开发者ID:BackupTheBerlios,项目名称:arp2-svn,代码行数:49,代码来源:req-test.c


示例6: readargs_file

static inline SIPTR readargs_file(CONST_STRPTR format, IPTR *args, CONST_STRPTR input, struct RDArgs **retp)
{
    SIPTR retval;
    struct RDArgs *ret;
    BPTR oldin;
    BPTR io;
    CONST_STRPTR tmpfile = "RAM:readargs.test";
    BPTR oldout;
    oldout = SelectOutput(Open("NIL:", MODE_NEWFILE));
   
    io = Open(tmpfile, MODE_NEWFILE);
    Write(io, input, strlen(input));
    Close(io);

    io = Open(tmpfile, MODE_OLDFILE);

    oldin = Input();
    SelectInput(io);
    SetIoErr(0);
    ret = ReadArgs(format, args, NULL);

    *retp = ret;
    retval = (ret != NULL) ? RETURN_OK : IoErr();

    Close(SelectInput(oldin));
    Close(SelectOutput(oldout));

    DeleteFile(tmpfile);

    return retval;
}
开发者ID:michalsc,项目名称:AROS,代码行数:31,代码来源:readargs.c


示例7: __seterrno

void __seterrno(void)
{ long amigaerror=IoErr(),*ptr=_errortable,err;

  while((err=*ptr++)&&(err!=amigaerror))
    ++ptr;
  errno=*ptr;
}
开发者ID:JamesLinus,项目名称:libnix,代码行数:7,代码来源:__seterrno.c


示例8: L_WB_DeleteDiskObject

// Patched DeleteDiskObject()
BOOL __asm __saveds L_WB_DeleteDiskObject(register __a0 char *name)
{
	struct LibData *data;
	struct MyLibrary *libbase;
	BOOL result;
	char *full_name;

	// Get library
	if (!(libbase=(struct MyLibrary *)FindName(&((struct ExecBase *)*((ULONG *)4))->LibList,"dopus5.library")))
		return 0;

	// Get data pointer
	data=(struct LibData *)libbase->ml_UserData;

	// Get full name
	full_name=icon_fullname(data,name);

	// Write icon
	result=L_DeleteIcon(name,libbase);

#define DOSBase (data->dos_base)

	// Succeeded?
	if ((result || IoErr()==ERROR_OBJECT_NOT_FOUND) && full_name)
		icon_notify(data,full_name,INF_FULLNAME,1);

#undef DOSBase

	// Free full name buffer
	FreeVec(full_name);
	return result;
}
开发者ID:MrZammler,项目名称:opus_magellan,代码行数:33,代码来源:icons.c


示例9: main

int main(int argc, char *argv)
{
    struct tracked_resource_kind *port_kind;
    struct tracked_pool *main_pool;
    struct tracked_resource *my_port_resource;
    struct MsgPort *my_port;

    make_resource_tracking();
    assert(!IoErr());

    port_kind = make_resource_kind("message port", (void(*)(void *)) DeletePort);
    assert(port_kind != NULL);

    main_pool = make_tracked_pool();
    assert(main_pool != NULL);

    my_port = CreatePort(PORTNAME,0);
    if (my_port != NULL) {
        my_port_resource = make_tracked_resource(main_pool, (void *) my_port, port_kind);
    } else {
        printf("cannot create port \"" PORTNAME "\"\n");
    }

    dispose_tracked_pool(main_pool);

    assert(FindPort(PORTNAME) == NULL);
    return 0;
}
开发者ID:roskakori,项目名称:sofa,代码行数:28,代码来源:test_c_resource_tracking.c


示例10: my_unlink

/******************************************************************
 * my_unlink: delete file 
 ******************************************************************/
int my_unlink (const TCHAR *name) {

  BOOL res;

  DebOut("name: %s\n", name);

  res=DeleteFile(name);

  if(res!=0) {
    return 0;
  }

  SetLastError(IoErr());
  DebOut("return -1 (%d)\n", IoErr());
  return -1;
}
开发者ID:Kalamatee,项目名称:WinUAE,代码行数:19,代码来源:fsdb_aros.cpp


示例11: write_env_string

static int write_env_string(APTR iff,char *str,ULONG id)
{
	if (*str && !(IFFWriteChunk(iff,str,id,strlen(str)+1)))
		return IoErr();

	return 0;
}
开发者ID:timofonic,项目名称:dopus5allamigas,代码行数:7,代码来源:environment.c


示例12: NameOfLock

/* Returns the lock of a name (Allocated with AllocVec()) */
STRPTR NameOfLock( BPTR lock )
{
	STRPTR n;
	BOOL again;
	ULONG bufSize = 127;
	if( !lock ) return NULL;

	do
	{
		again = FALSE;
		if((n = (STRPTR)AllocVec(bufSize, 0x10000 )))
		{
			if( NameFromLock( lock, n, bufSize-1 ) == DOSFALSE )
			{
				if( IoErr() == ERROR_LINE_TOO_LONG )
				{
					bufSize += 127;
					again = TRUE;
				}
				FreeVec(n);
				n = NULL;
			}
		}
	}	while(again);

	return n;
}
开发者ID:sba1,项目名称:simplemail,代码行数:28,代码来源:amigasupport.c


示例13: do_export_sites

static BOOL do_export_sites(struct display_globals *dg,char *path,LONG *diskerr)
{
BPTR cf;
struct site_entry *e;
struct Node *node,*next;
BOOL ok=FALSE;


if	((cf = Open(path, MODE_NEWFILE)))
	{
	if	((ok=Write(cf,head1,strlen(head1))))
		{
		node = dg->dg_og->og_SiteList->list.lh_Head;
		while	((next = node->ln_Succ))
			{
			e=(struct site_entry*)((Att_Node *)node)->data;
			if	(!(ok=write_entry(cf,e)))
				break;
			node = next;
			}
		}
	Close(cf);
	}

if	(!ok)
	*diskerr=IoErr();

return(ok);

}
开发者ID:timofonic,项目名称:dopus5allamigas,代码行数:30,代码来源:ftp_addrsupp.c


示例14: saveFile

void
saveFile(Entries entries, char *filename)
{
   BPTR f;
   struct IFFHandle *iff = NULL;

   f = Open(filename, MODE_NEWFILE);
   if (f == NULL) {
      myMsg3("couldn't open ", FileName, IoErr());
      return;
   }

   iff = AllocIFF();

   if (! iff) {
      myMsg1("couldn't alloc iff");
      return;
   }

   iff -> iff_Stream = f;

   InitIFFasDOS(iff);

   if (OpenIFF(iff, IFFF_WRITE)) {
      myMsg1("couldn't OpenIFF(WRITE)");
      return;
   }

   writeDatabaseFile(entries, iff);
   CloseIFF(iff);
   Close(iff -> iff_Stream);
   FreeIFF(iff);
}
开发者ID:cbeust,项目名称:banker-amiga,代码行数:33,代码来源:io.c


示例15: utime

int
utime(const char *name, const struct utimbuf *times)
{
  struct DateStamp stamp;
  unsigned long days, secs;
  time_t time;

  if (times == NULL)
    DateStamp(&stamp);
  else {
    /*
     * AmigaDOS file date is the modification time
     */
    time = times->modtime;

    /*
     * Convert time (secs since 1.1.1970 GMT) to
     * AmigaDOS DateStamp (based on 1.1.1978 local time).
     */
    time -= __local_to_GMT; /* GMT to local */
    days = (unsigned long)time / (unsigned long)(24*60*60);
    secs = (unsigned long)time % (unsigned long)(24*60*60);
    stamp.ds_Days = (LONG)days;
    stamp.ds_Minute = (LONG)(secs / 60);
    stamp.ds_Tick = (LONG)((secs % 60) * TICKS_PER_SECOND);
  }

  if (!SetFileDate((STRPTR)name, &stamp)) {
    set_errno(IoErr());
    return -1;
  }

  return 0;
}
开发者ID:Belxjander,项目名称:Kirito,代码行数:34,代码来源:utime.c


示例16: my_mkdir

/******************************************************************
 * my_mkdir / my_rmdir
 *
 * Create/Delete directories. Return AROS host error codes for 
 * AmigaOS guest CreateDir/DeleteFile calls.
 ******************************************************************/
int my_mkdir (const TCHAR *name) {

  BPTR lock;

  DebOut("name: %s\n", name);

  lock=CreateDir(name);

  if(lock) {
    UnLock(lock); /* CreateDir returns a lock, which we don't need */
    return 0;
  }

  SetLastError(IoErr());
  DebOut("return -1 (%d)\n", IoErr());
  return -1;
}
开发者ID:Kalamatee,项目名称:WinUAE,代码行数:23,代码来源:fsdb_aros.cpp


示例17: GetArguments

static void GetArguments(void)
{
    if (!(MyArgs = ReadArgs(ARG_TEMPLATE,Args,0)))
    {
    	Fault(IoErr(),0,s,255);
	Cleanup(s);
    }
}
开发者ID:michalsc,项目名称:AROS,代码行数:8,代码来源:showvisregion.c


示例18: ami_menu_arexx_scan

void ami_menu_arexx_scan(struct gui_window_2 *gwin)
{
	int item = AMI_MENU_AREXX;
	BPTR lock = 0;
	UBYTE *buffer;
	struct ExAllControl *ctrl;
	char matchpatt[16];
	LONG cont;
	struct ExAllData *ead;
	char *menu_lab;

	if(lock = Lock(nsoption_charp(arexx_dir), SHARED_LOCK))
	{
		if(buffer = AllocVecTagList(1024, NULL))
		{
			if(ctrl = AllocDosObject(DOS_EXALLCONTROL,NULL))
			{
				ctrl->eac_LastKey = 0;

				if(ParsePatternNoCase("#?.nsrx",(char *)&matchpatt,16) != -1)
				{
					ctrl->eac_MatchString = (char *)&matchpatt;
				}

				do
				{
					cont = ExAll(lock,(struct ExAllData *)buffer,1024,ED_COMMENT,ctrl);
					if((!cont) && (IoErr() != ERROR_NO_MORE_ENTRIES)) break;
					if(!ctrl->eac_Entries) continue;

					for(ead = (struct ExAllData *)buffer; ead; ead = ead->ed_Next)
					{
						if(item >= AMI_MENU_AREXX_MAX) continue;
						if(EAD_IS_FILE(ead))
						{
							gwin->menu[item].nm_Type = NM_ITEM;
							if(ead->ed_Comment[0] != '\0')
								menu_lab = ead->ed_Comment;
							else
								menu_lab = ead->ed_Name;

							ami_menu_alloc_item(gwin, item, NM_ITEM, menu_lab, 0, NULL,
								ami_menu_item_arexx_entries, (void *)strdup(ead->ed_Name));

							item++;
						}
					}
				}while(cont);
				FreeDosObject(DOS_EXALLCONTROL,ctrl);
			}
			FreeVec(buffer);
		}
		UnLock(lock);
	}

	gwin->menu[item].nm_Type = NM_END;
	gwin->menu[item].nm_Label = NULL;
}
开发者ID:ysei,项目名称:NetSurf,代码行数:58,代码来源:menu.c


示例19: return

char *read_dir(char *d)
/* get next file name from opened directory, NULL if no more entries */
{
  if (ExNext(((struct Dir *)d)->lock,&(((struct Dir *)d)->fib)))
    return ((struct Dir *)d)->fib.fib_FileName;
  if (IoErr() != ERROR_NO_MORE_ENTRIES)
    error(10,((struct Dir *)d)->name);
  return NULL;
}
开发者ID:8l,项目名称:vlink,代码行数:9,代码来源:dir.c



注:本文中的IoErr函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ IoFreeIrp函数代码示例发布时间:2022-05-30
下一篇:
C++ IoDeleteSymbolicLink函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap