________________________________
> Date: Thu, 7 Jun 2012 15:08:08 -0700
> Subject: win32 and modifying a file
> From: gai...@visioninfosoft.com
> To: Perl-Win32-Users@listserv.activestate.com
>
> dear win32 perl users, ive never actually known how to 'modfiy' a file
> using perl on win32. up till now, ive always read file1, found the
> data i intended to change, and have always created a new file 2
> containing the changes. if i wanted to 'simulate' changing file1, when
> done i could rename file2 to file1. in other words, ive never learned
> how to modify a file directly.
>
> ive read win32 makes it more difficult to do this than on unix os's.
>
> but in any case, today i wanted to ask the group.
>
> assumming 'file1' exists with the following 3 records in it:
>
> A
> B
> C
>
> is there a 'simple' code fragment someone could post that would
> demonstrate iterating through this file and when record 'B' is
> encountered, we want to change 'B' to 'B_modified' - done in a way
> where we only access 'file1'. maybe this cant be done, but im asking.
>
> yes i do realize there is another approach, upserp contents of 'file1'
> modify in memory, delete 'file1', then recreate it by dumping the
> in-memory modified contents. this seems more like a 'hack' than a
> direct manipulation of the original file.
>
> anyways, thanks to any who might be willing to enlighten me about this topic.
I'm not sure what the problem is, perl can't open a file for sysread and
syswrite at the same time? Maybe you want a MMF?
http://code.activestate.com/lists/perl-win32-users/33260/
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs