Page 1 of 1
[Implemented] For OpenFile() a new parmeter #PB_Append?
Posted: Thu Jul 24, 2008 8:31 am
by Falko
Hello Fred and PB-team
#PB_Append into Openfile() for set read/write pointer position for beginning opfenfile to end of File?
Posted: Thu Jul 24, 2008 9:21 am
by Little John
I do support this request. Reasons:
a) Such a feature is useful and not seldom needed.
b) People who have previously used another programming language probably know such a feature, and are confused when they don't find it in PB. This also means, that offering this feature would make it easier for programmers to switch from another language to PB.
c) Although we can implement this functionality ourselves, beginners can *not* do so.
Regards, Little John
Re: For OpenFile() a new parmeter #PB_Append?
Posted: Thu Jul 24, 2008 9:36 am
by jamirokwai
Falko wrote:Hello Fred and PB-team
#PB_Append into Openfile() for set read/write pointer position for beginning opfenfile to end of File?
I also support this request. For my latest Application, I needed to append data
to an existing file. I use FileSeek(0, LoF(0)) at the moment... Should be
possible without a second line of code, I think.
Re: For OpenFile() a new parmeter #PB_Append?
Posted: Thu Jul 24, 2008 9:49 am
by PB
> FileSeek(0, LoF(0))
You can always create a new macro command made up of OpenFile and
FileSeek(0, LoF(0)) after it, make it a resident, then the new command will
always be available when you run PureBasic without any extra typing at all.
The new command could be named something like AppendFile(#num,name$).
Oh damn, I think I even further dissuaded the team from doing it now.
(For the record, I've love an append flag too).
Re: For OpenFile() a new parmeter #PB_Append?
Posted: Thu Jul 24, 2008 10:12 am
by Little John
PB wrote:> FileSeek(0, LoF(0))
You can always create a new macro command made up of CreateFile and
FileSeek(0, LoF(0)) after it,
CreateFile() will
delete any existing file. This certainly is
not wanted, when someone intends to append stuff to an existing file.
Writing a macro as suggested is not easy for new users of PB, and -- as you demonstrated

-- there is some risk of making a fatal mistake.
Regards, Little John
Posted: Thu Jul 24, 2008 10:15 am
by Falko
+1

Re: For OpenFile() a new parmeter #PB_Append?
Posted: Thu Jul 24, 2008 10:29 am
by PB
> CreateFile() will delete any existing file
Ah, that was just a typo. Of course I meant OpenFile. I've edited my post.
Posted: Thu Jul 24, 2008 1:14 pm
by Kaeru Gaman
I think the Team has more relevant things to do than caring about such peepee....
In my eyey, it's better to let a beginner see what is necessary to append to a file
than let him believe you could magically open a file with the pointer at the end.
Posted: Thu Jul 24, 2008 1:33 pm
by Little John
Kaeru Gaman wrote:I think the Team has more relevant things to do than caring about such peepee....
I think the team members can decide that themselves. In any case, this sub-forum is for posting wishes, no?
Kaeru Gaman wrote:In my eyey, it's better to let a beginner see what is necessary to append to a file
than let him believe you could magically open a file with the pointer at the end.
From a current thread in the German forum, where both you and me participate, we know that this seems to be too hard for some beginners. And in the proposed functionality, there is no magic involved. It is standard in several other languages. I already wrote above, why implementing standard features can be advantageous also for Fantaisie Software themselves.
Regards, Little John