Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Low-Level File IO question' topicStudent Support Forum > General > Archives > "Low-Level File IO question"

Next Comment >Help | Reply To Topic
Author Comment/Response
Tom
02/19/11 3:49pm

Hello,

I would like to do the following:

- Open a file for reading
- Seek to a certain byte offset
- Overwrite the FIRST instance of "abc" to "def" (I will only be replacing equal-length strings)
- Save the file

I would like to do this efficiently as possible. The file is large (ReplaceAll has proven too slow), but the first instance of "abc" will be very close to the known byte offset.

I have tried to do this using SetStreamPosition[...], but I get the error "General::openw: OutputStream[...] is open for output".

Is it possible to seek to a byte offset and overwrite in Mathematica?

Thanks,
Tom

URL: ,

Subject (listing for 'Low-Level File IO question')
Author Date Posted
Low-Level File IO question Tom 02/19/11 3:49pm
Re: Low-Level File IO question Isaac 02/24/11 1:33pm
Re: Low-Level File IO question Tom 02/24/11 4:09pm
Next Comment >Help | Reply To Topic