I want to be able to add to the top of a file, but I can only find out how to add to the bottom of a file. Currently I am using:
fopen file 0_CREAT|0_WRONLY|O_APPEND "C:\SBBS\XTRN\INFO\INFO.LST"
and that appends to the bottom of the list, but I want to show the newest to oldest, not oldest to newest.
I'm assuming I just leave off the O_APPEND, but is there a correct way.
I want to be able to add to the top of a file, but I can only find out how to add to the bottom of a file. Currently I am using:
fopen file 0_CREAT|0_WRONLY|O_APPEND "C:\SBBS\XTRN\INFO\INFO.LST"
and that appends to the bottom of the list, but I want to show the newest to oldest, not oldest to newest.
I'm assuming I just leave off the O_APPEND, but is there a correct way.
Re: Syntax
By: DesotoFireflite to All on Mon Mar 07 2022 08:41 am
I want to be able to add to the top of a file, but I can only find out
how to add to the bottom of a file. Currently I am using:
fopen file 0_CREAT|0_WRONLY|O_APPEND "C:\SBBS\XTRN\INFO\INFO.LST"
and that appends to the bottom of the list, but I want to show the
newest to oldest, not oldest to newest.
I'm assuming I just leave off the O_APPEND, but is there a correct
way.
Leaving off O_APPEND will *overwrite* the portions of the file you write to. There is no standard method for "inserting" data into a file. You would have to read the file contents and re-write them with the "inserted" data first, then the old data.
Re: Syntax
By: DesotoFireflite to All on Mon Mar 07 2022 08:41 am
I want to be able to add to the top of a file, but I can only find out
how to add to the bottom of a file. Currently I am using:
fopen file 0_CREAT|0_WRONLY|O_APPEND "C:\SBBS\XTRN\INFO\INFO.LST"
and that appends to the bottom of the list, but I want to show the
newest to oldest, not oldest to newest.
I'm assuming I just leave off the O_APPEND, but is there a correct
way.
i probably could have done this like 15 or more years ago with baja, but I can't process the way to do it now.
what i would do (which requires no brain power) is to cat your new line to a new file, then cat your current list to that file, then move that file over your info.lst
or if your list file has a date or something sortable, you could just sort the file.
Re: SyntaxWhat are you trying to achieve? If part of the file changes, could you
By: Digital Man to DesotoFireflite on Mon Mar 07 2022 08:58 am
Re: Syntax
By: DesotoFireflite to All on Mon Mar 07 2022 08:41 am
I want to be able to add to the top of a file, but I can only
find out how to add to the bottom of a file. Currently I am
using:
fopen file 0_CREAT|0_WRONLY|O_APPEND "C:\SBBS\XTRN\INFO\INFO.LST"
and that appends to the bottom of the list, but I want to show the
newest to oldest, not oldest to newest.
I'm assuming I just leave off the O_APPEND, but is there a correct
way.
Leaving off O_APPEND will *overwrite* the portions of the file
you write to. There is no standard method for "inserting" data
into a file. You would have to read the file contents and
re-write them with the "inserted" data first, then the old data.
Ok, Thanks, that was what I was afraid off... Looks like I have some
work to do. <BFG>
SysOp: C.G. Learn, AKA: DesotoFireflite
Valhalla Home Services! - (Synchronet) - bbs.valhallabbs.com
Valhalla II! - (GAP) - bbs.valhallabbs.com:24
Valhalla III! - (RemoteAccess) - bbs.valhallabbs.com:5023
Valhalla IIII! - (Dungeons & Dragons BBS) - bbs.valhallabbs.com:26
Valhalla Home Services Web! - http://bbs.valhallabbs.com
A Gamers Paradise - Over 150 Registered Online Game Doors!
Home Of Odin's Maze Game Server!
--- CAT (n.), Furry keyboard cover.
â– Synchronet â– Valhalla Home Services â– USA â– http://valhalla.synchro.net
On Mon, 7 Mar 2022 13:14:24 -0500
"DesotoFireflite" <desotofireflite@VERT/VALHALLA> wrote:
Re: Syntax
By: Digital Man to DesotoFireflite on Mon Mar 07 2022 08:58 am
Re: Syntax
By: DesotoFireflite to All on Mon Mar 07 2022 08:41 am
I want to be able to add to the top of a file, but I can only
find out how to add to the bottom of a file. Currently I am
using:
fopen file 0_CREAT|0_WRONLY|O_APPEND "C:\SBBS\XTRN\INFO\INFO.LST"
DM>and that appends to the bottom of the list, but I want to show the
newest to oldest, not oldest to newest.
I'm assuming I just leave off the O_APPEND, but is there a correct
way.
Leaving off O_APPEND will *overwrite* the portions of the file
you write to. There is no standard method for "inserting" data
into a file. You would have to read the file contents and
re-write them with the "inserted" data first, then the old data.
Ok, Thanks, that was what I was afraid off... Looks like I have some
work to do. <BFG>
What are you trying to achieve? If part of the file changes, could you
use an include to read in the bit that changes, and then just write
your included file?
Re: Re: Syntax
By: Nelgin to All on Sun Mar 13 2022 01:12 am
On Mon, 7 Mar 2022 13:14:24 -0500
"DesotoFireflite" <desotofireflite@VERT/VALHALLA> wrote:
Re: Syntax
By: Digital Man to DesotoFireflite on Mon Mar 07 2022 08:58 am
Re: Syntax
By: DesotoFireflite to All on Mon Mar 07 2022 08:41 am
I want to be able to add to the top of a file, but I can only
find out how to add to the bottom of a file. Currently I am
using:
fopen file 0_CREAT|0_WRONLY|O_APPEND
"C:\SBBS\XTRN\INFO\INFO.LST"
and that appends to the bottom of the list, but I want to show
the newest to oldest, not oldest to newest.
I'm assuming I just leave off the O_APPEND, but is there a
correct way.
DM>Leaving off O_APPEND will *overwrite* the portions of the file
you write to. There is no standard method for "inserting" data
into a file. You would have to read the file contents and
re-write them with the "inserted" data first, then the old
data.
Ok, Thanks, that was what I was afraid off... Looks like I have
some work to do. <BFG>
What are you trying to achieve? If part of the file changes,
could you use an include to read in the bit that changes, and
then just write your included file?
It's just a graffiti wall I'm working on, but I wrote it to put the
new info at the bottom, but now I've changed my mind and wan't the
newest additions at the top. Thanks for the suggestion. I'm gonna
play with it in a few days as soon as time let's me. I got side
tracked working on another project. Again, Thanks
drinkarse
girls
arse"|tac
Sysop: | Saxainden |
---|---|
Location: | Littleton, CO |
Users: | 30 |
Nodes: | 10 (0 / 10) |
Uptime: | 05:40:26 |
Calls: | 350 |
Messages: | 36,669 |