Menu

[424828]: / src / rtlib / file_input_file.c  Maximize  Restore  History

Download this file

36 lines (27 with data), 711 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* input function */
#include "fb.h"
FBCALL int fb_FileInput( int fnum )
{
FB_INPUTCTX *ctx;
FB_FILE *handle = NULL;
FB_LOCK();
handle = FB_FILE_TO_HANDLE(fnum);
if( !FB_HANDLE_USED(handle) )
{
FB_UNLOCK();
return fb_ErrorSetNum( FB_RTERROR_ILLEGALFUNCTIONCALL );
}
ctx = FB_TLSGETCTX( INPUT );
ctx->handle = handle;
ctx->status = 0;
fb_StrDelete( &ctx->str );
ctx->index = 0;
FB_UNLOCK();
return fb_ErrorSetNum( FB_RTERROR_OK );
}
void fb_INPUTCTX_Destructor( void* data )
{
FB_INPUTCTX *ctx = (FB_INPUTCTX *)data;
fb_StrDelete( &ctx->str );
/* The file handle is closed by the program, it's not ours to clean up */
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.