O_TEXT,在微软环境中 [英] O_TEXT, in microsoft environment

查看:161
本文介绍了O_TEXT,在微软环境中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在openoft和O_TEXT中打开一个文件,在微软环境中,然后用b / b
读取它,它是在文本模式下完成的。


文本模式究竟意味着什么?


如何处理阅读?


如何以书面形式处理?


文本模式对

文件中函数返回位置有影响吗?如果是,哪一个?

When opening a file with open and O_TEXT, in microsoft environment, and
then reading it with read, it is done in text mode.

What does text mode exactly mean?

How is it handled in reading?

How is it handled in writing?

does text mode has an impact on function returning position within the
file? If yes, which one?


推荐答案

O_TEXT写道:
O_TEXT wrote:

在openoft和O_TEXT中打开一个文件,在微软环境中,然后用b / b
读取它,它是在文本模式下完成的。


文本模式究竟意味着什么?


如何处理阅读?


如何以书面形式处理?


文本模式对

文件中函数返回位置有影响吗?如果是,哪一个?

When opening a file with open and O_TEXT, in microsoft environment, and
then reading it with read, it is done in text mode.

What does text mode exactly mean?

How is it handled in reading?

How is it handled in writing?

does text mode has an impact on function returning position within the
file? If yes, which one?



做你自己的家庭作业!

-

jacob navia

jacob at jacob point remcomp point fr

logiciels / informatique
http://www.cs.virginia.edu/~lcc-win32




" O_TEXT" < O _ **** @ nospam.frwrote in message

news:fh *********** @ biggoron.nerim.net ...

"O_TEXT" <O_****@nospam.frwrote in message
news:fh***********@biggoron.nerim.net...

在openoft和O_TEXT中打开一个文件,在microsoft环境中,然后用b / b
读取它,它是在文本模式下完成的。


文本模式到底意味着什么?


如何处理阅读?


如何处理写作?


文本模式是否会对

文件中的函数返回位置产生影响?如果是,哪一个?
When opening a file with open and O_TEXT, in microsoft environment, and
then reading it with read, it is done in text mode.

What does text mode exactly mean?

How is it handled in reading?

How is it handled in writing?

does text mode has an impact on function returning position within the
file? If yes, which one?



如果您要在老式行式打印机上打印,您需要告诉

打印机要移动下一行,也可以返回。

但是如果你在现代键盘上打字,通常返回按钮

会自动将光标移动到下一行。

所以问题是是否将换行符表示为\ n或\ n \\\ r。

操作系统做出不同的选择。但是,ANSI C已经决定使用\ n或仅限换行路由。

。因此,如果您在文本

模式下打开文件\\\\ nn操作系统\ r将被静默压制。

这仅适用于实际代表文本的文件。二进制文件可能

有\ n\\\纯粹偶然嵌入其中的序列。


因此在标准库中我们使用


fopen(filename," r");


以文本模式打开阅读


fopen(文件名,rb)


以二进制模式打开。


O_TEXT只是微软为同一个

底层系统提供的另一种界面


-

免费游戏和编程好东西。
http://www.personal.leeds.ac.uk/~bgy1mm

If you are printing out on an old-fashioned line printer you need to tell
the printer to move down to the next line, and also to return.
However if you are typing on a modern keyboard, usually the return button
will automatically move the cursor to the next line.
So the question is whether to represent newlines as "\n" or "\n\r".
Operating systems make different choices. However ANSI C has decided that
the "\n", or newline only route, will be used. So if you open a file in text
mode on an "\r\n" operating system the "\r" will be silently suppressed.
This is only good for files that actually represent text. Binary files might
have "\n\r" sequences embedded in them purely by chance.

So in the standard library we use

fopen(filename, "r");

to open in text mode for reading

fopen(filename, "rb")

to open in binary mode.

O_TEXT is just an alternative interface Microsoft have provided to the same
underlying system

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm


Malcolm McLeanaécrit:
Malcolm McLean a écrit :

>

" O_TEXT" < O _ **** @ nospam.frwrote in message

news:fh *********** @ biggoron.nerim.net ...
>
"O_TEXT" <O_****@nospam.frwrote in message
news:fh***********@biggoron.nerim.net...

>当打开一个带有open和O_TEXT的文件时,在微软环境中,
然后用read读取它,它是在文本模式下完成的。
文本模式究竟意味着什么?

如何处理阅读?

如何以书面形式处理?

文本模式有
文件中对函数返回位置的影响?如果是,哪一个?
>When opening a file with open and O_TEXT, in microsoft environment,
and then reading it with read, it is done in text mode.

What does text mode exactly mean?

How is it handled in reading?

How is it handled in writing?

does text mode has an impact on function returning position within the
file? If yes, which one?



如果您要在老式行式打印机上打印,则需要

告诉打印机移动下一行,也可以返回。

但是如果你在现代键盘上打字,通常返回

按钮会自动将光标移动到下一行。

所以问题是是否将换行符表示为\ n或\ n \\\ r。

操作系统做出不同的选择。但是,ANSI C已经决定使用\ n或仅换行路由来使用
。因此,如果您在文本模式下打开一个

文件,请输入\\\\ nn。操作系统\ r将静默禁止



这仅适用于实际代表文本的文件。二进制文件

可能有\ n \\\ rd纯粹偶然嵌入其中的序列。


因此在标准库中我们使用


fopen(filename," r");


以文本模式打开阅读


fopen(文件名,rb)


以二进制模式打开。


O_TEXT只是微软提供给

相同底层系统的替代界面

If you are printing out on an old-fashioned line printer you need to
tell the printer to move down to the next line, and also to return.
However if you are typing on a modern keyboard, usually the return
button will automatically move the cursor to the next line.
So the question is whether to represent newlines as "\n" or "\n\r".
Operating systems make different choices. However ANSI C has decided
that the "\n", or newline only route, will be used. So if you open a
file in text mode on an "\r\n" operating system the "\r" will be
silently suppressed.
This is only good for files that actually represent text. Binary files
might have "\n\r" sequences embedded in them purely by chance.

So in the standard library we use

fopen(filename, "r");

to open in text mode for reading

fopen(filename, "rb")

to open in binary mode.

O_TEXT is just an alternative interface Microsoft have provided to the
same underlying system



没关系,我理解\\ n \\ n \\ n的翻译机制。


但我不明白的是read和lseek值是否是字节

偏移量或字符偏移量。


如果您读取包含3900个翻译字符的4096字节,将

读取返回4096或3900?什么是lseek?


okay, I understand the \r\n -\n translation mechanism.

But what I do not understand is whether read and lseek values are bytes
offset or character offset.

If you read 4096 bytes which contain 3900 translated characters, will
read return 4096 or 3900? what''s about lseek?


这篇关于O_TEXT,在微软环境中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆