472,363 Members | 2,067 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,363 software developers and data experts.

How to bypass Windows 'cooking' the I/O? (One more time, please)



I know I saw the answer recently, as in since February '08, but I can't
re-find it. :( I tried the mail archives and such and my own
collections but the piece I saw still eludes me.
Problem: (sos=same old s...) Microsoft insists the world work it's way
even when the Microsoft way was proven wrong decades ago. In this case
it's (still) 'cooking' the writes even with 'rwb' and O_RDWR|O_BINARY in
(proper respective) use.

Specific: python created and inspected binary file ends:
00460: 0D 1A (this is correct)

after a write
os.lseek(target, -1, 2)
os.write(target,record)
the expected result would be:
00460: 0D 20 .....data bytes.... 1A

BUT I get:
00460: 20 .... data bytes... 1A

It is one byte off!!! And the 0D has to be there. Signifies the end of
the header.
Same python program runs as expected in Linux. Maybe because that's
where it was written?! :)
What I seek is the way to slap Microsoft up side the head and make it
work correctly. OK, well, at least in this situation.
Note: Things like this justify Python implementers bypassing OS calls
(data fetch, data write) and using the BIOS direct. Remember, the CPU
understands bit patterns only. It has no comprehension of 'text',
'program', 'number', 'pointer', blah blah blah.... All that is totally
beyond it's understanding. A given bit pattern means 'do that'. The CPU
is 100% binary. Memory, storage and the rest is just bits-on, bits-off.
Patterns. Proper binary I/O is mandatory for the machine to function.
Anyway - if whoever mentioned the flags and such to 'over ride'
Microsoft's BS would re-send that piece I would be very appreciative.
Steve
no******@hughes.net
Jul 4 '08 #1
2 1237
norseman wrote:
>

I know I saw the answer recently, as in since February '08, but I can't
re-find it. :( I tried the mail archives and such and my own
collections but the piece I saw still eludes me.
Problem: (sos=same old s...) Microsoft insists the world work it's way
even when the Microsoft way was proven wrong decades ago. In this case
it's (still) 'cooking' the writes even with 'rwb' and O_RDWR|O_BINARY in
(proper respective) use.

Specific: python created and inspected binary file ends:
00460: 0D 1A (this is correct)

after a write
os.lseek(target, -1, 2)
os.write(target,record)
the expected result would be:
00460: 0D 20 .....data bytes.... 1A

BUT I get:
00460: 20 .... data bytes... 1A

It is one byte off!!! And the 0D has to be there. Signifies the end of
the header.
Same python program runs as expected in Linux. Maybe because that's
where it was written?! :)
What I seek is the way to slap Microsoft up side the head and make it
work correctly. OK, well, at least in this situation.
Note: Things like this justify Python implementers bypassing OS calls
(data fetch, data write) and using the BIOS direct. Remember, the CPU
understands bit patterns only. It has no comprehension of 'text',
'program', 'number', 'pointer', blah blah blah.... All that is totally
beyond it's understanding. A given bit pattern means 'do that'. The CPU
is 100% binary. Memory, storage and the rest is just bits-on, bits-off.
Patterns. Proper binary I/O is mandatory for the machine to function.
Anyway - if whoever mentioned the flags and such to 'over ride'
Microsoft's BS would re-send that piece I would be very appreciative.
Steve
no******@hughes.net
Since you didn't show any code context, I'll try my mind reading superpowers.....

You may be the victim of buffering (not calling .flush() or .close() to commit
your write to disk). Why aren't you using the file object to do you seek and write?

Normal file I/O sequence:

fp = open(target, 'wb')

fp.seek(-1, 2)

fp.write(record)

by going through os. methods instead of the file instance I think you are
accessing the file through 2 different I/O buffers. I could be all wrong here.

-Larry
Jul 4 '08 #2
norseman wrote:
In this case it's [MS Windows] (still) 'cooking' the writes even
with 'rwb' and O_RDWR|O_BINARY in (proper respective) use.

Specific: python created and inspected binary file ends:
00460: 0D 1A (this is correct)
I'm not actually sure what the 0x1a is supposed to do there. The 0x0d is
a '\r' which looks like a MacOS line ending, but I also seem to remember
0x1a being use as EOF signal in some old system's text files. Anyway, you
mentioned some "binary file" (aren't they all?) so this might not matter
after all.
after a write
os.lseek(target, -1, 2)
That should be os.SEEK_END and not 2. In any case, it moves the write
position to the last byte (-1 offset to the end of the file).
os.write(target,record)
the expected result would be:
00460: 0D 20 .....data bytes.... 1A
I'm sorry, but I don't see that. write() will not insert the bytes but first
overwrite till EOF and then append further output, i.e. the 0x1a at the end
is only present if it was present in the record.
BUT I get:
00460: 20 .... data bytes... 1A

It is one byte off!!! And the 0D has to be there. Signifies the end of
the header.
Okay, this looks strange, both the offset and the fact that it seems to
insert bytes. How about providing a minimal example?
Anyway - if whoever mentioned the flags and such to 'over ride'
Microsoft's BS would re-send that piece I would be very appreciative.
You are not one with the Tao, which is why you programs don't run. ;)

Uli

--
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932

Jul 7 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jean | last post by:
Hi everyone, I was hoping somebody could assist me in this issue. I am quite a newbie to ODBC connections and was struggling to search for related topics. Here is my situation: I have a...
2
by: Frank | last post by:
Hi, I wasn't sure which group to use but I'm developing a web application that connects to a sql server. This application is for External Clients but the information is sensitive. I thougth that...
6
by: MLH | last post by:
I am unsure how to do this. I want this tray to be used for certain print jobs - jobs that will prompt me to load the bypass tray with sheet labels. How to force this? Dunno. Its the HP LaserJet...
3
by: CanuckChuck | last post by:
I have a code for enabling a command button to password protect the enabling/disabling of the Shift bypass. For some reason though I keep recieving a syntax error when I try to use it. I copied the...
1
by: OlaPihl | last post by:
Hi, How can I by code enable and disable "Bypass proxy server for local adresses" in Internet Explorer / Tools / Internet Options / Connections / LAN Settings. I have made a program (VB.Net)...
0
by: Iain King | last post by:
On Jul 7, 10:18am, Dennis Lee Bieber <wlfr...@ix.netcom.comwrote: lol @ op not finding the answer to his question in the archives, then being answered again by someone who doesn't let his...
0
by: norseman | last post by:
Dennis Lee Bieber wrote: ============================================= "I wouldn't expect..." ABSOLUTELY CORRECT. No append because the hex-1A has to be overwritten. (use r+b) There can be only...
0
by: saravrs | last post by:
Could you please provide source code to bypass the windows authetication while opening a web page from Visual basic 6.0 or VB.Net application? I would like to hard code my AD user id/password in...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
1
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.