Revision history for KeyPgPutfileio


Revision [22660]

Last edited on 2019-04-16 12:56:09 by badidea [Removed 2nd tag fbdoc "ex"]

No Differences

Revision [21307]

Edited on 2016-04-03 16:21:17 by fxm [Put() returns a 32 bit Long]
Additions:
##Put()## returns a 32 bit ##[[KeyPgLong|Long]]##: ##0## on success; nonzero on error. "disk full" is considered as an error, and results in return code ##3##. An "exact" amount of data written before is not available, and wouldn't be really useful anyway.
Deletions:
##0## on success; nonzero on error. "disk full" is considered as an error, and results in return code ##3##. An "exact" amount of data written before is not available, and wouldn't be really useful anyway.


Revision [21100]

Edited on 2016-03-13 09:33:28 by fxm [Formatting]
Additions:



Revision [20474]

Edited on 2016-02-10 16:07:23 by DkLwikki [Update link format]
Additions:
**Put** #//filenum// [[KeyPgAs|As]] [[KeyPgLong|long]], [//position// [[KeyPgAs|As]] [[KeyPgLongint|longint]]], //data// [[KeyPgAs|As]] [[KeyPgAny|Any]] [, //amount// [[KeyPgAs|As]] [[KeyPgUinteger|Uinteger]]]
**Put** #//filenum// [[KeyPgAs|As]] [[KeyPgLong|long]], [//position// [[KeyPgAs|As]] [[KeyPgLongint|longint]]], //data// [[KeyPgAs|As]] [[KeyPgString|String]]
**Put** #//filenum// [[KeyPgAs|As]] [[KeyPgLong|long]], [//position// [[KeyPgAs|As]] [[KeyPgLongint|longint]]], //data()// [[KeyPgAs|As]] [[KeyPgAny|Any]]
The value passed to ##[[KeyPgOpen|Open]]## when the file was opened.
When putting ##[[KeyPgString|String]]##s, the number of bytes written is the same as the number of bytes in the string data. ##//amount//## is not allowed.
Note: If you want to write values from a buffer, you should NOT pass a pointer to the buffer; instead you should pass the first variable in the buffer. (This can be done by dereferencing the pointer with ##[[KeyPgOpValueOf|Operator * (Value of)]]##.) If you pass a pointer directly, then ##**Put**## will put the memory from the pointer variable, not the memory it points to.
Makes ##Put## write to file ##//amount//## consecutive variables to the file - i.e. it writes ##( //amount// * [[KeyPgSizeof|Sizeof]](//data//) )## bytes of data, starting at ##//data//##'s location in memory, into the file. If ##//amount//## is omitted it defaults to ##1##, meaning that ##**Put**## just writes a single variable.
Writes binary data from a buffer variable to a file opened in ##[[KeyPgBinary|Binary]]## or ##[[KeyPgRandom|Random]]## mode.
For files opened in ##[[KeyPgRandom|Random]]## mode, the size in bytes of the data to write must match the specified record size.
- ##[[KeyPgPutgraphics|Put (Graphics)]]## different usage of same keyword
- ##[[KeyPgGetfileio|Get (File I/O)]]##
- ##[[KeyPgOpen|Open]]##
- ##[[KeyPgClose|Close]]##
- ##[[KeyPgRandom|Random]]##
- ##[[KeyPgBinary|Binary]]##
- ##[[KeyPgFreefile|Freefile]]##
Deletions:
**Put** #//filenum// [[KeyPgAs As]] [[KeyPgLong long]], [//position// [[KeyPgAs As]] [[KeyPgLongint longint]]], //data// [[KeyPgAs As]] [[KeyPgAny Any]] [, //amount// [[KeyPgAs As]] [[KeyPgUinteger Uinteger]]]
**Put** #//filenum// [[KeyPgAs As]] [[KeyPgLong long]], [//position// [[KeyPgAs As]] [[KeyPgLongint longint]]], //data// [[KeyPgAs As]] [[KeyPgString String]]
**Put** #//filenum// [[KeyPgAs As]] [[KeyPgLong long]], [//position// [[KeyPgAs As]] [[KeyPgLongint longint]]], //data()// [[KeyPgAs As]] [[KeyPgAny Any]]
The value passed to ##[[KeyPgOpen Open]]## when the file was opened.
When putting ##[[KeyPgString String]]##s, the number of bytes written is the same as the number of bytes in the string data. ##//amount//## is not allowed.
Note: If you want to write values from a buffer, you should NOT pass a pointer to the buffer; instead you should pass the first variable in the buffer. (This can be done by dereferencing the pointer with ##[[KeyPgOpValueOf Operator * (Value of)]]##.) If you pass a pointer directly, then ##**Put**## will put the memory from the pointer variable, not the memory it points to.
Makes ##Put## write to file ##//amount//## consecutive variables to the file - i.e. it writes ##( //amount// * [[KeyPgSizeof Sizeof]](//data//) )## bytes of data, starting at ##//data//##'s location in memory, into the file. If ##//amount//## is omitted it defaults to ##1##, meaning that ##**Put**## just writes a single variable.
Writes binary data from a buffer variable to a file opened in ##[[KeyPgBinary Binary]]## or ##[[KeyPgRandom Random]]## mode.
For files opened in ##[[KeyPgRandom Random]]## mode, the size in bytes of the data to write must match the specified record size.
- ##[[KeyPgPutgraphics Put (Graphics)]]## different usage of same keyword
- ##[[KeyPgGetfileio Get (File I/O)]]##
- ##[[KeyPgOpen Open]]##
- ##[[KeyPgClose Close]]##
- ##[[KeyPgRandom Random]]##
- ##[[KeyPgBinary Binary]]##
- ##[[KeyPgFreefile Freefile]]##


Revision [17532]

Edited on 2015-04-01 12:34:28 by DkLwikki [integer => long/uinteger]
Additions:
**Put** #//filenum// [[KeyPgAs As]] [[KeyPgLong long]], [//position// [[KeyPgAs As]] [[KeyPgLongint longint]]], //data// [[KeyPgAs As]] [[KeyPgAny Any]] [, //amount// [[KeyPgAs As]] [[KeyPgUinteger Uinteger]]]
**Put** #//filenum// [[KeyPgAs As]] [[KeyPgLong long]], [//position// [[KeyPgAs As]] [[KeyPgLongint longint]]], //data// [[KeyPgAs As]] [[KeyPgString String]]
**Put** #//filenum// [[KeyPgAs As]] [[KeyPgLong long]], [//position// [[KeyPgAs As]] [[KeyPgLongint longint]]], //data()// [[KeyPgAs As]] [[KeyPgAny Any]]
Deletions:
**Put** #//filenum// [[KeyPgAs As]] [[KeyPgInteger integer]], [//position// [[KeyPgAs As]] [[KeyPgLongint longint]]], //data// [[KeyPgAs As]] [[KeyPgAny Any]] [, //amount// [[KeyPgAs As]] [[KeyPgInteger Integer]]]
**Put** #//filenum// [[KeyPgAs As]] [[KeyPgInteger Integer]], [//position// [[KeyPgAs As]] [[KeyPgLongint longint]]], //data// [[KeyPgAs As]] [[KeyPgString String]]
**Put** #//filenum// [[KeyPgAs As]] [[KeyPgInteger Integer]], [//position// [[KeyPgAs As]] [[KeyPgLongint longint]]], //data()// [[KeyPgAs As]] [[KeyPgAny Any]]


Revision [16714]

Edited on 2013-03-31 23:08:49 by CountingPine [Slight improvements to examples]
Additions:
' Create variables for the file number, and the number to put
Dim As Integer f
Dim As Long value
' Find the first free file number
f = Freefile()
' Open the file "file.ext" for binary usage, using the file number "f"
value= 10
' Write the bytes of the integer 'value' into the file, using file number "f"
' starting at the beginning of the file (position 1)
Put #f, 1, value
' Close the file
For i As Integer = 1 To 10
' Find the first free file file number
f = Freefile()
' Open the file "file.ext" for binary usage, using the file number "f"
' starting at the beginning of the file (position 1)
' Close the file
Size = 256
lpBuffer = Allocate(Size)
For Counter = 0 to Size-1
lpBuffer[Counter] = (Counter and &HFF)
' Get free file file number
' Open the file "test.bin" in binary writing mode
' Write 256 bytes from the memory pointed to by lpBuffer
Put #hFile, , lpBuffer[0], Size
' Close the file
' Free the allocated memory
Deletions:
' Create integer variables (our buffer has just 4 bytes)
Dim As Integer buffer , f
' Find the first free file file number.
f = Freefile
' Open the file "file.ext" for binary usage, using the file number "f".
buffer=10
' Write 4 bytes from the buffer into the file, using file number "f"
' starting at the beginning of the file (1).
Put #f, 1, buffer
' Close the file.
' End the program.
End
Dim i As Integer
For i = 1 To 10
' Find the first free file file number.
f = Freefile
' Open the file "file.ext" for binary usage, using the file number "f".
' starting at the beginning of the file (1).
' Close the file.
' End the program.
End
Size=256
lpBuffer=Allocate(Size)
For Counter=0 to Size-1
lpBuffer[Counter]=(Counter and &HFF)
' Get free file file number.
' Open the file "test.bin" in binary writing mode.
' Write 256 bytes from the memory pointened by lpBuffer.
Put #hFile, , lpBuffer[0],Size
' Close the file.
' Free the allocated memory.
' End the program.
End


Revision [15865]

Edited on 2012-01-26 19:03:53 by CountingPine [Remove stray '=====']
Additions:
Makes ##Put## write to file ##//amount//## consecutive variables to the file - i.e. it writes ##( //amount// * [[KeyPgSizeof Sizeof]](//data//) )## bytes of data, starting at ##//data//##'s location in memory, into the file. If ##//amount//## is omitted it defaults to ##1##, meaning that ##**Put**## just writes a single variable.
Deletions:
Makes ##Put## write to file ##//amount//## consecutive variables to the file - i.e. it writes ##( //amount// * [[KeyPgSizeof Sizeof]](//data//) )## bytes of data, starting at ##//data//##'s location in memory, into the file. If ##//amount//## is omitted it defaults to ##1##, meaning that ##**Put**## just writes a single variable.=====


Revision [14839]

Edited on 2010-09-25 13:39:58 by AgAmemnus [this sentence doesn't have any meaning / is incorrect]
Additions:
Note: If you want to write values from a buffer, you should NOT pass a pointer to the buffer; instead you should pass the first variable in the buffer. (This can be done by dereferencing the pointer with ##[[KeyPgOpValueOf Operator * (Value of)]]##.) If you pass a pointer directly, then ##**Put**## will put the memory from the pointer variable, not the memory it points to.
Deletions:
Note: If you want to write values from a buffer, you should NOT pass a pointer to the buffer; instead you should pass the first variable in the buffer. (This can be done by dereferencing the pointer with ##[[KeyPgOpValueOf Operator * (Value of)]]##.) Put will automatically infer that the rest of the buffer continues after the first variable. If you pass a pointer directly, then ##**Put**## will put the memory from the pointer variable, not the memory it points to.


Revision [14096]

Edited on 2009-01-17 20:35:23 by CountingPine [Further clarification on the "amount" issue]
Additions:
**Put** #//filenum// [[KeyPgAs As]] [[KeyPgInteger Integer]], [//position// [[KeyPgAs As]] [[KeyPgLongint longint]]], //data// [[KeyPgAs As]] [[KeyPgString String]]
Is the buffer where data is written from. It can be a numeric variable, a string, an array or a user-defined type. The operation will try to transfer to disk the complete variable, unless ##//amount//## is given.
When putting arrays, ##//data//## should be followed by an empty pair of brackets: '##()##'. ##**Put**## will write all of the data in the array. ##//amount//## is not allowed.
When putting ##[[KeyPgString String]]##s, the number of bytes written is the same as the number of bytes in the string data. ##//amount//## is not allowed.
Makes ##Put## write to file ##//amount//## consecutive variables to the file - i.e. it writes ##( //amount// * [[KeyPgSizeof Sizeof]](//data//) )## bytes of data, starting at ##//data//##'s location in memory, into the file. If ##//amount//## is omitted it defaults to ##1##, meaning that ##**Put**## just writes a single variable.=====
Deletions:
Is the buffer where data is written from. It can be a numeric variable, a string, an array or a user-defined type. The operation will try to transfer to disk the complete variable, unless ##//amount//## is given. When putting arrays, ##//data//## should be followed by an empty pair of brackets: '##()##'. ##**Put**## will write all of the data in the array. ##//amount//## is not allowed.
Makes ##Put## write to file ##//amount// * [[KeyPgSizeof Sizeof]](//buffer_datatype//)## bytes of data. If ##//amount//## is omitted it defaults to ##1##, and ##**Put**## just writes a single variable of the buffer's data type..


Revision [14068]

Edited on 2008-12-28 18:16:57 by CountingPine [When position = 0...]
Additions:
Is the position where ##Put## must start in the file. If the file was opened ##For Random##, the position is in records, else it is given in bytes. If omitted, writing starts at the present file pointer position. The position is 1-based: i.e. the first record or byte of a file is at position ##1##.
If ##//position//## is omitted or zero (##0##), file writing will start from the current file position.
Is the buffer where data is written from. It can be a numeric variable, a string, an array or a user-defined type. The operation will try to transfer to disk the complete variable, unless ##//amount//## is given. When putting arrays, ##//data//## should be followed by an empty pair of brackets: '##()##'. ##**Put**## will write all of the data in the array. ##//amount//## is not allowed.
Deletions:
Is the position where ##Put## must start in the file. If the file was opened ##For Random##, the position is in records, else it is given in bytes. If omitted, writing starts at the present file pointer position. The position is 1-based: the first record or byte of a file is at position ##1##.
Is the buffer where data is written from. It can be a numeric variable, a string, an array or a user-defined type. The operation will try to transfer to disk the complete variable, unless ##//amount//## is given. When putting arrays, ##//data//## should be followed by an empty pair of brackets: "##()##". ##**Put**## will write all of the data in the array. ##//amount//## is not allowed.


Revision [14001]

Edited on 2008-12-01 04:59:09 by DoS386 [+link]
Additions:
' Create integer variables (our buffer has just 4 bytes)
Dim As Integer buffer , f
- ##[[KeyPgPutgraphics Put (Graphics)]]## different usage of same keyword
Deletions:
' Create a integer variable
Dim buffer As Integer, f as integer


Revision [13843]

Edited on 2008-10-30 19:19:02 by CountingPine [+link]
Additions:
- ##[[KeyPgRandom Random]]##
- ##[[KeyPgBinary Binary]]##


Revision [13834]

Edited on 2008-10-30 18:53:51 by CountingPine [+link]
Additions:
Is the position where ##Put## must start in the file. If the file was opened ##For Random##, the position is in records, else it is given in bytes. If omitted, writing starts at the present file pointer position. The position is 1-based: the first record or byte of a file is at position ##1##.
Is the buffer where data is written from. It can be a numeric variable, a string, an array or a user-defined type. The operation will try to transfer to disk the complete variable, unless ##//amount//## is given. When putting arrays, ##//data//## should be followed by an empty pair of brackets: "##()##". ##**Put**## will write all of the data in the array. ##//amount//## is not allowed.
Note: If you want to write values from a buffer, you should NOT pass a pointer to the buffer; instead you should pass the first variable in the buffer. (This can be done by dereferencing the pointer with ##[[KeyPgOpValueOf Operator * (Value of)]]##.) Put will automatically infer that the rest of the buffer continues after the first variable. If you pass a pointer directly, then ##**Put**## will put the memory from the pointer variable, not the memory it points to.
Makes ##Put## write to file ##//amount// * [[KeyPgSizeof Sizeof]](//buffer_datatype//)## bytes of data. If ##//amount//## is omitted it defaults to ##1##, and ##**Put**## just writes a single variable of the buffer's data type..
##0## on success; nonzero on error. "disk full" is considered as an error, and results in return code ##3##. An "exact" amount of data written before is not available, and wouldn't be really useful anyway.
Writes binary data from a buffer variable to a file opened in ##[[KeyPgBinary Binary]]## or ##[[KeyPgRandom Random]]## mode.
##**Put**## can be used as a function, and will return ##0## on success or an error code on failure.
- ##**Put**## can write full arrays as in VB or, alternatively, write a multiple of the data size from ##//buffer//##'s memory location.
- ##**Put**## can be used as a function in FB, to find the success/error code returned without having to use error handling procedures.
Deletions:
Is the position where ##Put## must start in the file. If the file was opened ##For Random##, the position is in records, else it is given in bytes. If omitted, writing starts at the present file pointer position. The position is 1 based: the first record or byte of a file is at position 1.
Is the buffer where data is written from. It can be a numeric variable, a string, an array or a user-defined type. The operation will try to transfer to disk the complete variable, unless ##//amount//## is given. When putting arrays, ##//data//## should be followed by an empty pair of brackets: "()". Put will write all of the data in the array. ##//amount//## is not allowed.
Makes ##Put## write to file ##//amount// * [[KeyPgSizeof Sizeof]](//buffer_datatype//)## bytes of data. If ##//amount//## is omitted, ##Put## just writes a single variable.
0 on success; nonzero on error. "disk full" is considered as error, results in return code 3. An "exact" amount of data written before is not available, and wouldn't be really useful anyway.
Writes binary data from a buffer variable to a file.
##**Put**## can be used as a function, and will return 0 on success or an error code on failure.
- PUT can write full arrays as in VB or, alternatively, write a multiple of the data size from //buffer//'s memory location.
- PUT can now be used as a function.


Revision [13532]

The oldest known version of this page was created on 2008-07-17 05:46:32 by DoS386 [+link]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode