当前位置: 首页>>代码示例>>C++>>正文


C++ FileSeek函数代码示例

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


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

示例1: SaveToFile

static
void SaveToFile(Widget w, FILE *fp)
{
	DviWidget dw = (DviWidget)w;
	long pos;
	int c;

	if (dw->dvi.tmpFile) {
		pos = ftell(dw->dvi.tmpFile);
		if (dw->dvi.ungot) {
			pos--;
			dw->dvi.ungot = 0;
			/* The ungot character is in the tmpFile, so we don't
			   want to read it from file. */
			(void)getc(dw->dvi.file);
		}
	}
	else
		pos = ftell(dw->dvi.file);
	FileSeek(dw, 0L);
	while (DviGetC(dw, &c) != EOF)
		if (putc(c, fp) == EOF) {
			/* XXX print error message */
			break;
		}
	FileSeek(dw, pos);
}
开发者ID:ajinkya93,项目名称:netbsd-src,代码行数:27,代码来源:Dvi.c

示例2: FileOpen

void __fastcall TFrmMain::btRowSaveClick(TObject* Sender)
{
    if (OpenOk == false) return;

    int iFileHandle; //文件句柄
    char Txtbuf[255];
    int iVal;
    char buf[4];
    float fVal;
    FILE* stream;
    long curpos, length;
    DWORD dwRows, dwCols, dwRowLen, dwTextLen;

    DWORD dwTextStartPos;
    char* pTextPtr ;


    //if ((stream = fopen(CurrentOpenFile.c_str(), "r+"))
    //    == NULL)
    //{
    //   ShowMessage("打开文件出错");
    //   return;
    //}

    //curpos = ftell(stream);
    //fseek(stream, 0L, SEEK_END);
    //length = ftell(stream);
    iFileHandle = FileOpen(CurrentOpenFile, fmOpenRead | fmOpenWrite); //打开文件

    for (int i = 0; i < sgEdit->ColCount - 1; i++)
    {
        switch (thOpen->ColType[i])
        {
            case 0: //整型值             sgEdit->Row
                //fseek(stream, 0x14+((sgEdit->Row-1)*(sgEdit->ColCount-1)+i)*4, 0);
                //iVal=StrToInt(sgEdit->Cells[i+1][sgEdit->Row]);
                //fwrite(&iVal, 4, 1, stream);
                iVal = StrToInt(sgEdit->Cells[i + 1][sgEdit->Row]);
                memcpy(buf, &iVal, 4);
                FileSeek(iFileHandle, 0x14 + ((sgEdit->Row - 1) * (sgEdit->ColCount - 1) + i) * 4, 0);
                FileWrite(iFileHandle, buf, 4);
                break;
            case 1: //浮点值
                //fseek(stream, 0x14+((sgEdit->Row-1)*(sgEdit->ColCount-1)+i)*4, 0);
                //fVal=StrToFloat(sgEdit->Cells[i+1][sgEdit->Row]);
                //fwrite(&fVal, 4, 1, stream);
                fVal = StrToFloat(sgEdit->Cells[i + 1][sgEdit->Row]);
                memcpy(buf, &fVal, 4);
                FileSeek(iFileHandle, 0x14 + ((sgEdit->Row - 1) * (sgEdit->ColCount - 1) + i) * 4, 0);
                FileWrite(iFileHandle, buf, 4);
                break;
            case 2: //文本   不存
                break;
        }
    }
    //fclose(stream);
    FileClose(iFileHandle);
    ShowMessage("The " + IntToStr(sgEdit->Row) + " Row Write Ok!");
}
开发者ID:natedahl32,项目名称:portalclassic,代码行数:59,代码来源:dbcedit.cpp

示例3: mdextend

/*
 *	mdextend() -- Add a block to the specified relation.
 *
 *		The semantics are basically the same as mdwrite(): write at the
 *		specified position.  However, we are expecting to extend the
 *		relation (ie, blocknum is the current EOF), and so in case of
 *		failure we clean up by truncating.
 *
 *		This routine returns true or false, with errno set as appropriate.
 *
 * Note: this routine used to call mdnblocks() to get the block position
 * to write at, but that's pretty silly since the caller needs to know where
 * the block will be written, and accordingly must have done mdnblocks()
 * already.  Might as well pass in the position and save a seek.
 */
bool
mdextend(SMgrRelation reln, BlockNumber blocknum, char *buffer, bool isTemp)
{
	long		seekpos;
	int			nbytes;
	MdfdVec    *v;

	v = _mdfd_getseg(reln, blocknum, false);

#ifndef LET_OS_MANAGE_FILESIZE
	seekpos = (long) (BLCKSZ * (blocknum % ((BlockNumber) RELSEG_SIZE)));
	Assert(seekpos < BLCKSZ * RELSEG_SIZE);
#else
	seekpos = (long) (BLCKSZ * (blocknum));
#endif

	/*
	 * Note: because caller obtained blocknum by calling _mdnblocks, which did
	 * a seek(SEEK_END), this seek is often redundant and will be optimized
	 * away by fd.c.  It's not redundant, however, if there is a partial page
	 * at the end of the file.	In that case we want to try to overwrite the
	 * partial page with a full page.  It's also not redundant if bufmgr.c had
	 * to dump another buffer of the same file to make room for the new page's
	 * buffer.
	 */
	if (FileSeek(v->mdfd_vfd, seekpos, SEEK_SET) != seekpos)
		return false;

	if ((nbytes = FileWrite(v->mdfd_vfd, buffer, BLCKSZ)) != BLCKSZ)
	{
		if (nbytes > 0)
		{
			int			save_errno = errno;

			/* Remove the partially-written page */
			FileTruncate(v->mdfd_vfd, seekpos);
			FileSeek(v->mdfd_vfd, seekpos, SEEK_SET);
			errno = save_errno;
		}
		return false;
	}

	if (!isTemp)
	{
		if (!register_dirty_segment(reln, v))
			return false;
	}

#ifndef LET_OS_MANAGE_FILESIZE
	Assert(_mdnblocks(v->mdfd_vfd, BLCKSZ) <= ((BlockNumber) RELSEG_SIZE));
#endif

	return true;
}
开发者ID:alecclarke,项目名称:postgresql-8.1.4,代码行数:69,代码来源:md.c

示例4: delete

void TForm1::ProcessFile(String fName){
    int iFileHandle;
    if(theBuffer) delete [] theBuffer;
    theBuffer=NULL;

    for(int i=0; i<lstResults->Items->Count; i++){
        delete (MyResult*)lstResults->Items->Item[i]->Data;
    }
    lstResults->Items->BeginUpdate();
    lstResults->Items->Clear();
    lstResults->Items->EndUpdate();

    char* rawBuffer=NULL;
    Screen->Cursor = crHourGlass;
    try{
        if(!FileExists(fName)) return;
        iFileHandle = FileOpen(fName, fmOpenRead);
        if(iFileHandle == -1){
			MessageBox(this->Handle, L"Could not open the specified file.", L"Error", MB_ICONEXCLAMATION);
			return;
        }
        int fileLength = FileSeek(iFileHandle,0,2);
        FileSeek(iFileHandle,0,0);
        rawBuffer = new char[fileLength+1];
        FileRead(iFileHandle, rawBuffer, fileLength);
        FileClose(iFileHandle);

        //strip whitespace and punctuation from text
        theBuffer = new char[fileLength+1];
        bufSize = 0;
        char *c=rawBuffer, c1;
        for(int i=0; i<fileLength; i++){
            c1 = *c++;
            if((c1 >= 'A') && (c1 <= 'Z')){
                theBuffer[bufSize++] = c1;
            }
            else if(((c1 >= 'a') && (c1 <= 'z'))){
                theBuffer[bufSize++] = c1-32;
            }
        }

        this->Caption = (Application->Title + " - " + fName);
        textPosition = 0;

    }__finally{
        if(rawBuffer){
            delete [] rawBuffer;
        }
        Screen->Cursor = crDefault;
        RedrawBitmap();
    }
}
开发者ID:Bindambc,项目名称:MathApps,代码行数:52,代码来源:Unit1.cpp

示例5: ShowMessage

//---------------------------------------------------------------------------
//当前格子写入修改文件中
void __fastcall TFrmMain::N4Click(TObject* Sender)
{
    if (!thOpen) return;

    int iFileHandle; //文件句柄
    char buf[4];
    int iVal;
    float fVal;
    FILE* stream;
    /*
       if ((stream = fopen(CurrentOpenFile.c_str(), "r+"))
           == NULL)
       {
          ShowMessage("打开文件出错");
          return;
       }
    */
    iFileHandle = FileOpen(CurrentOpenFile, fmOpenRead | fmOpenWrite); //打开文件

    switch (thOpen->ColType[sgEdit->Col])
    {
        case 0: //整型值
            //for(int i=0;i<sgEdit->RowCount-1;i++){
            /*
                fseek(stream, 0x14+((sgEdit->Row-1)*(sgEdit->ColCount-1)+(sgEdit->Col-1))*4, 0);
                iVal=StrToInt(sgEdit->Cells[sgEdit->Col][sgEdit->Row]);
                memcpy(buf, &iVal, 4);
                for(int i=0;i<4;i++)
                    fwrite(buf+i, 1, 1, stream);
            */
            iVal = StrToInt(sgEdit->Cells[sgEdit->Col][sgEdit->Row]);
            memcpy(buf, &iVal, 4);
            FileSeek(iFileHandle, 0x14 + ((sgEdit->Row - 1) * (sgEdit->ColCount - 1) + (sgEdit->Col - 1)) * 4, 0);
            FileWrite(iFileHandle, buf, 4);
            //}
            break;
        case 1: //浮点值
            //fseek(stream, 0x14+((sgEdit->Row-1)*(sgEdit->ColCount-1)+(sgEdit->Col-1))*4, 0);
            //fVal=StrToFloat(sgEdit->Cells[sgEdit->Col][sgEdit->Row]);
            //fwrite(&fVal, 4, 1, stream);
            fVal = StrToFloat(sgEdit->Cells[sgEdit->Col][sgEdit->Row]);
            memcpy(buf, &fVal, 4);
            FileSeek(iFileHandle, 0x14 + ((sgEdit->Row - 1) * (sgEdit->ColCount - 1) + (sgEdit->Col - 1)) * 4, 0);
            FileWrite(iFileHandle, buf, 4);
            break;
        case 2: //文本不写入
            break;
    }

    // fclose(stream);
    FileClose(iFileHandle);
}
开发者ID:natedahl32,项目名称:portalclassic,代码行数:54,代码来源:dbcedit.cpp

示例6: FileCopy

int FileCopy( const char *pFileIn, const char *pFileOut,
			  int (*pfnCallback)( const char *p1, const char *p2, unsigned int nCopied,
			  unsigned int nTotal ) )
{

	FHANDLE fh_in, fh_out;
	u8 chunk[CHUNK_SIZE];
	int read;
	u64 copied, total;

	fh_in = FileOpen( pFileIn, O_RDONLY );
	if( fh_in.fh == -1 )
		return 0;

	fh_out = FileOpen( pFileOut, O_RDWR | O_CREAT | O_TRUNC );
	if( fh_out.fh == -1 )
		return 0;

	total = FileSeek( fh_in, 0, SEEK_END );
	FileSeek( fh_in, 0, SEEK_SET );

	// copy file in chunks
	copied = 0;

	while(1)
	{
		read = FileRead( fh_in, chunk, sizeof(chunk) );

		if( read <= 0 )
			break;

		FileWrite( fh_out, chunk, read );
		copied += read;

		if( pfnCallback )
		{
			if( !pfnCallback( pFileIn, pFileOut, copied, total ) )
			{
				FileClose(fh_in);
				FileClose(fh_out);
				return 0;
			}
		}
	}

	FileClose(fh_in);
	FileClose(fh_out);
	return 1;
}
开发者ID:smiley22,项目名称:myPS2,代码行数:49,代码来源:file.c

示例7: FileSeek

int BDATreader::printlist() {
    int res,laststate,n;
    long lastpos;
    string tname;
    datablockinfo db,saveddb;
    if(state>0) {
        laststate=state;
        lastpos=pos;
        saveddb=lastinfo;
        state=1;pos=8;
        FileSeek(f,pos,SEEK_SET);
        res=getnextblockinfo(db);
        printf("BDAT binary data file information:\n - name %s\n - size: %ld\n",filename.c_str(),size);
        n=1;
        while(res==0) {
            printf(" - data block %d\n   - name: %s\n   - ID: %d\n   - type: (%08X) ",n,lastinfo.name.c_str(),lastinfo.ID,lastinfo.type);
            switch (lastinfo.type) {
                case DT_bit:tname="bits";break;
                case DT_byte:tname="byte";break;
                case DT_ubyte:tname="unsigned byte";break;
                case DT_word:tname="word/2-byte integer";break;
                case DT_uword:tname="unsigned word/2-byte integer";break;
                case DT_int:tname="int/4-byte integer";break;
                case DT_uint:tname="unsigned int/4-byte integer";break;
                case DT_long:tname="long int/8-byte integer";break;
                case DT_ulong:tname="unsigned long int/8-byte integer";break;
                case DT_single:tname="float/4-byte floating point number";break;
                case DT_double:tname="double/8-byte floating point number";break;
                case DT_quad:tname="quad/16-byte floating point number";break;
                case DT_csingle:tname="complex float/two 4-byte floating point numbers";break;
                case DT_cdouble:tname="complex double/two 8-byte floating point numbers";break;
                case DT_cquad:tname="complex quad/two 16-byte floating point number";break;
                case DT_user:tname="user defined format";break;
                default:tname="unknown";break;
            }
            printf("%s\n   - records: %d\n   - record size: %d bytes\n   - data size: %d bytes\n",tname.c_str(),lastinfo.records,lastinfo.recordsize,lastinfo.records*lastinfo.recordsize);
            res=skipblock();
            if(res==0) res=getnextblockinfo(db);
            n++;
        }
        state=laststate;
        pos=lastpos;
        lastinfo=saveddb;
        FileSeek(f,pos,SEEK_SET);
    }
    else return -1; //file needs to be open
    return 0;
};
开发者ID:demarle,项目名称:vortexfinder2,代码行数:48,代码来源:datafile.cpp

示例8: mdread

/*
 *	mdread() -- Read the specified block from a relation.
 */
void
mdread(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
	   char *buffer)
{
	off_t		seekpos;
	int			nbytes;
	MdfdVec    *v;

	TRACE_POSTGRESQL_SMGR_MD_READ_START(forknum, blocknum,
										reln->smgr_rnode.spcNode,
										reln->smgr_rnode.dbNode,
										reln->smgr_rnode.relNode);

	v = _mdfd_getseg(reln, forknum, blocknum, false, EXTENSION_FAIL);

	seekpos = (off_t) BLCKSZ *(blocknum % ((BlockNumber) RELSEG_SIZE));

	Assert(seekpos < (off_t) BLCKSZ * RELSEG_SIZE);

	if (FileSeek(v->mdfd_vfd, seekpos, SEEK_SET) != seekpos)
		ereport(ERROR,
				(errcode_for_file_access(),
				 errmsg("could not seek to block %u in file \"%s\": %m",
						blocknum, FilePathName(v->mdfd_vfd))));

	nbytes = FileRead(v->mdfd_vfd, buffer, BLCKSZ);

	TRACE_POSTGRESQL_SMGR_MD_READ_DONE(forknum, blocknum,
									   reln->smgr_rnode.spcNode,
									   reln->smgr_rnode.dbNode,
									   reln->smgr_rnode.relNode,
									   nbytes,
									   BLCKSZ);

	if (nbytes != BLCKSZ)
	{
		if (nbytes < 0)
			ereport(ERROR,
					(errcode_for_file_access(),
					 errmsg("could not read block %u in file \"%s\": %m",
							blocknum, FilePathName(v->mdfd_vfd))));

		/*
		 * Short read: we are at or past EOF, or we read a partial block at
		 * EOF.  Normally this is an error; upper levels should never try to
		 * read a nonexistent block.  However, if zero_damaged_pages is ON or
		 * we are InRecovery, we should instead return zeroes without
		 * complaining.  This allows, for example, the case of trying to
		 * update a block that was later truncated away.
		 */
		if (zero_damaged_pages || InRecovery)
			MemSet(buffer, 0, BLCKSZ);
		else
			ereport(ERROR,
					(errcode(ERRCODE_DATA_CORRUPTED),
					 errmsg("could not read block %u in file \"%s\": read only %d of %d bytes",
							blocknum, FilePathName(v->mdfd_vfd),
							nbytes, BLCKSZ)));
	}
}
开发者ID:badalex,项目名称:postgresql-scratchpad,代码行数:63,代码来源:md.c

示例9: FileHandle

    FileHandle(const wchar_t* path, uint64 offset)
    {
        hFileSrc = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr);

        if (offset != 0)
            FileSeek(hFileSrc, offset);
    }
开发者ID:Translator5,项目名称:desura-app,代码行数:7,代码来源:UMcf.cpp

示例10: switch

bool File::Seek(int p, int from)
{
	switch(srctype)
	{
	case MODE_MYFILE:
	case MODE_EXTFILE:
	       return FileSeek(file,p,from);
		break;
	case MODE_MYDATA:
	case MODE_EXTDATA:
		switch (from)
		{
		//case SEEK_CUR:
		case FILESEEKCURRENT:
			if(datapos + p >= datasize || datapos + p < 0)
				return false;
			datapos += p;
			break;
		//case SEEK_SET:
		case FILESEEKSTART:
			if(p >= datasize || p < 0)
				return false;
			datapos = p;
			break;
		//case SEEK_END:
		case FILESEEKEND:
			if(datasize + p < 0 || p > 0)
				return false;
			datapos = datasize + p;
			break;
		}
	}
	return true;
}
开发者ID:jtritell,项目名称:KrisLibrary,代码行数:34,代码来源:myfile.cpp

示例11: tmdLoadHeader

uint_fast8_t tmdLoadHeader(tmd_data *data, wchar_t *path) { //validate and load tmd header
	File fil;
	size_t offset, size;
	tmd_data data_tmp;
	tmd_content_chunk *content_chunk_tmp;
	uint_fast16_t content_count;
	uint8_t hash[SHA_256_SIZE];
	
	if (!FileOpen(&fil, path, 0) || (
		(FileRead2(&fil, &data_tmp.sig_type, sizeof(data_tmp.sig_type)) != sizeof(data_tmp.sig_type) ||
		(offset = tmdHeaderOffset(data_tmp.sig_type)) == 0 ||
		!FileSeek(&fil, offset) ||
		FileRead2(&fil, &data_tmp.header, sizeof(data_tmp.header) + sizeof(data_tmp.content_info)) != sizeof(data_tmp.header) + sizeof(data_tmp.content_info)) &&
		(FileClose(&fil) || 1)
	)) return 0;
	sha(hash, &data_tmp.content_info, sizeof(data_tmp.content_info), SHA_256_MODE);
	if (memcmp(hash, data_tmp.header.content_info_hash, sizeof(hash))) return FileClose(&fil) && 0;
	size = (content_count = __builtin_bswap16(data_tmp.header.content_count)) * sizeof(tmd_content_chunk);
	content_chunk_tmp = __builtin_alloca(size);
	if (FileRead2(&fil, content_chunk_tmp, size) != size) return FileClose(&fil) && 0;
	FileClose(&fil);
	for (uint_fast16_t info_index = 0, chunk_index = 0, chunk_count; chunk_index < content_count; info_index++, chunk_index += chunk_count) {
		if (info_index >= sizeof(data_tmp.content_info)/sizeof(tmd_content_info) ||
			(chunk_count = __builtin_bswap16(data_tmp.content_info[info_index].content_command_count)) == 0
		) return 0;
		sha(hash, &content_chunk_tmp[chunk_index], chunk_count * sizeof(tmd_content_chunk), SHA_256_MODE);
		if (memcmp(hash, data_tmp.content_info[chunk_index].content_chunk_hash, sizeof(hash))) return 0;
	}
	*data = data_tmp;
	return 1;
}
开发者ID:dukesrg,项目名称:rxTools,代码行数:31,代码来源:tmd.c

示例12: tmdPreloadChunk

size_t tmdPreloadChunk(tmd_data *data, wchar_t *path, uint_fast16_t content_index) { //loads tmd chunk records and returns total chunks size of content index type on success
	FIL fil;
	size_t offset, size = 0;
	uint_fast16_t content_count, chunk_count;
	uint8_t hash[SHA_256_SIZE];
	
	if (FileOpen(&fil, path, 0) && (offset = tmdHeaderOffset(data->sig_type))) {
		size = (content_count = __builtin_bswap16(data->header.content_count)) * sizeof(tmd_content_chunk);
		if (!data->content_chunk)
			data->content_chunk = __builtin_alloca(size);
		if (FileSeek(&fil, offset + sizeof(data->header) + sizeof(data->content_info)) && FileRead2(&fil, data->content_chunk, size) == size) {
			size = 0;
			for (uint_fast16_t info_index = 0, chunk_index = 0; chunk_index < content_count; info_index++) {
				chunk_count = __builtin_bswap16(data->content_info[info_index].content_command_count);
				sha(hash, &data->content_chunk[chunk_index], chunk_count * sizeof(tmd_content_chunk), SHA_256_MODE);
				if (memcmp(hash, data->content_info[chunk_index].content_chunk_hash, sizeof(hash))) {
					size = 0;
					break;
				}
				for (; chunk_count > 0; chunk_index++, chunk_count--) {
					if (content_index == CONTENT_INDEX_ALL || content_index == data->content_chunk[chunk_index].content_index)
						size += __builtin_bswap32(data->content_chunk[chunk_index].content_size_lo);
				}
			}
		} else size = 0;
		FileClose(&fil);
	}
	return size;
}
开发者ID:dukesrg,项目名称:rxTools,代码行数:29,代码来源:tmd.c

示例13: FileGets

	//! Read a complete line from a file and return it as a string, treats CR, LF, CRLF and LFCR as valid line ends
	std::string FileGets(FileHandle File)
	{
		std::string Line;
		if(!FileValid(File)) return Line;

		while(!FileEof(File))
		{
			char c = static_cast<char>(FileGetc(File));
			
			// Enf of line?
			if((c == '\n') || (c == '\r'))
			{
				// If not the last item byte in the file...
				if(!FileEof(File))
				{
					// Check the next byte, and if it is something we should not have read, push it back by seeking back
					UInt64 Pos = FileTell(File);
					char c2 = static_cast<char>(FileGetc(File));

					// We only discard a second character if it is also a \n or \r, but not a duplicate of the first
					if(((c2 != '\n') && (c2 != '\r')) || (c2 == c)) FileSeek(File, Pos);
				}
				break;
			}

			Line += c;
		}

		return Line;
	}
开发者ID:Dheeraj-B,项目名称:mxflib,代码行数:31,代码来源:helper.cpp

示例14: palm_fseek

/*============================================================================

  Description: See documentation for standard C library fseek

  ==========================================================================*/
unsigned short palm_fseek( PALM_FILE* io_pSF, long in_lOffset, short in_nOrigin )
{
    FileOriginEnum PalmOrigin = fileOriginCurrent;

/*
#define SEEK_CUR    1
#define SEEK_END    2
#define SEEK_SET    0

*/
    ChASSERT(io_pSF->volRef == ((UInt16)-1));

    switch( in_nOrigin  )
    {
        case 0:
        PalmOrigin = fileOriginBeginning;
        break;

        case 1:
        PalmOrigin = fileOriginCurrent;
        break;

        case 2:
        PalmOrigin = fileOriginEnd;
        break;

        default:
        // error !!
        return 0xFFFF;
        break;
    }
	
    return FileSeek( io_pSF->file.fh, in_lOffset, PalmOrigin );
}
开发者ID:killbug2004,项目名称:WSProf,代码行数:39,代码来源:ChFileIO.cpp

示例15: BufFileLoadBuffer

/*
 * BufFileLoadBuffer
 *
 * Load some data into buffer, if possible, starting from curOffset.
 * At call, must have dirty = false, pos and nbytes = 0.
 * On exit, nbytes is number of bytes loaded.
 */
static int BufFileLoadBuffer(BufFile *file, void* buffer, size_t bufsize)
{
	int nb;

	/*
	 * May need to reposition physical file.
	 */
	if (FileSeek(file->file, file->offset, SEEK_SET) != file->offset)
	{
		elog(ERROR, "could not seek in temporary file: %m");
	}

	/*
	 * Read whatever we can get, up to a full bufferload.
	 */
	nb = FileRead(file->file, buffer, (int)bufsize);
	if (nb < 0)
	{
		elog(ERROR, "could not read from temporary file: %m");
	}

	/* we choose not to advance curOffset here */

	return nb;
}
开发者ID:AnLingm,项目名称:gpdb,代码行数:32,代码来源:buffile.c


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