FREEFILE

From MCS Wiki AVR
(Difference between revisions)
Jump to: navigation, search
(Created page with "= <span class="f_Header">Action</span> = Returns a free Filenumber. <span style="font-family: Arial;"> </span> <span style="font-family: Arial;"> </span> = <span...")
 
 
Line 43: Line 43:
 
= <span class="f_Header">See also</span> =
 
= <span class="f_Header">See also</span> =
  
[http://avrhelp.mcselec.com/initfilesystem.htm INITFILESYSTEM]&nbsp;,&nbsp;[http://avrhelp.mcselec.com/open.htm OPEN]&nbsp;,&nbsp;[http://avrhelp.mcselec.com/close.htm CLOSE],&nbsp;[http://avrhelp.mcselec.com/flush.htm FLUSH]&nbsp;,&nbsp;[http://avrhelp.mcselec.com/print.htm PRINT],&nbsp;[http://avrhelp.mcselec.com/line_input.htm LINE INPUT],&nbsp;[http://avrhelp.mcselec.com/loc.htm LOC],&nbsp;[http://avrhelp.mcselec.com/lof.htm LOF]&nbsp;,&nbsp;[http://avrhelp.mcselec.com/eof.htm EOF]&nbsp;,&nbsp;[http://avrhelp.mcselec.com/fileattr.htm FILEATTR]&nbsp;,&nbsp;[http://avrhelp.mcselec.com/seek.htm SEEK]&nbsp;,&nbsp;[http://avrhelp.mcselec.com/bsave.htm BSAVE]&nbsp;,&nbsp;[http://avrhelp.mcselec.com/bload.htm BLOAD]&nbsp;,&nbsp;[http://avrhelp.mcselec.com/kill.htm KILL]&nbsp;,[http://avrhelp.mcselec.com/diskfree.htm DISKFREE]&nbsp;,&nbsp;[http://avrhelp.mcselec.com/disksize.htm DISKSIZE]&nbsp;,&nbsp;[http://avrhelp.mcselec.com/get.htm GET]&nbsp;,&nbsp;[http://avrhelp.mcselec.com/put.htm PUT]&nbsp;,&nbsp;[http://avrhelp.mcselec.com/filedate.htm FILEDATE]&nbsp;,&nbsp;[http://avrhelp.mcselec.com/filetime.htm FILETIME]&nbsp;,&nbsp;[http://avrhelp.mcselec.com/filedatetime.htm FILEDATETIME]&nbsp;,&nbsp;[http://avrhelp.mcselec.com/dir.htm DIR]&nbsp;,&nbsp;[http://avrhelp.mcselec.com/filelen.htm FILELEN]&nbsp;,&nbsp;[http://avrhelp.mcselec.com/write.htm WRITE]&nbsp;,&nbsp;[http://avrhelp.mcselec.com/input.htm INPUT]
+
[[INITFILESYSTEM]] , [[OPEN]] , [[CLOSE]], [[FLUSH]] , [[PRINT]], [[LINE INPUT]], [[LOC]], [[LOF]] , [[EOF]] , [[FILEATTR]] , [[SEEK]] , [[BSAVE]] , [[BLOAD]] , [[KILL]] ,[[DISKFREE]] , [[DISKSIZE]] , [[GET]] , [[PUT]] , [[FILEDATE]] , [[FILETIME]] , [[FILEDATETIME]] , [[DIR]] , [[FILELEN]] , [[WRITE]] , [[INPUT]]
  
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>

Latest revision as of 19:15, 11 February 2013

Contents

Action

Returns a free Filenumber.

 

 

Syntax

bFileNumber = FREEFILE()

 

 

Remarks

bFileNumber

A byte variable , which can be used for opening next file

 

 

This function gives you a free file number, which can be used for file – opening statements. In contrast to VB this file numbers start with 128 and goes up to 255. Use range 1 to 127 for user defined file numbers to avoid file number conflicts with the system numbers from FreeFile()

 

This function is implemented for compatility with VB.

 

 

See also

INITFILESYSTEM , OPEN , CLOSE, FLUSH , PRINT, LINE INPUT, LOC, LOF , EOF , FILEATTR , SEEK , BSAVE , BLOAD , KILL ,DISKFREE , DISKSIZE , GET , PUT , FILEDATE , FILETIME , FILEDATETIME , DIR , FILELEN , WRITE , INPUT

 

 

ASM

Calls

_GetFreeFileNumber

 

Input

none

 

Output

r24: Filenumber

r25: Errorcode

 

C-Flag: Set on Error

 

 


 

Partial Example


Ff =Freefile() ' get file handle
Open"test.txt" For Input As #ff ' we can use a constant for the file too
Print Lof(#ff);" length of file"
Print Fileattr(#ff);" file mode" ' should be 1 for input
Do
 LineInput #ff , S ' read a line
' line input is used to read a line of text from a file
Print S ' print on terminal emulator
Loop UntilEof(ff)<> 0
'The EOF() function returns a non-zero number when the end of the file is reached
'This way we know that there is no more data we can read
Close #ff

Languages   English Deutsch  
Personal tools
Namespaces
Variants
Actions
Navigation
In other languages
Language