473,395 Members | 1,532 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

What is formfeed

how does the '\f' affect output?
in what situation will I use '\f' ?

--
¶À¤l¹Å½×¼Æ¾Ç®a:

¡u¼Æ¾Ç®a¤@¥Í¥u·d¨â¼ËªF¦è¡G¤£¬O·d¼Æ¾Ç´N¬O·d¤k¤H¡C
¦ý¬O§Ú¤£¬O¼Æ¾Ç®a¡K¡v

Nov 13 '05 #1
8 20824
Chun-Chieh Wang <sh***@es01.adm.nctu.edu.tw> wrote in
news:be***********@netnews.csie.NCTU.edu.tw:
how does the '\f' affect output?
in what situation will I use '\f' ?


If sent to a printer, it *might* eject the current page. If sent to a
terminal window, it might push the text up some number of lines. In
practice, I don't think I've ever used it. Why don't you try it and see
what it does?

--
- Mark ->
--
Nov 13 '05 #2
In <be***********@netnews.csie.NCTU.edu.tw> Chun-Chieh Wang <sh***@es01.adm.nctu.edu.tw> writes:
how does the '\f' affect output?
"Form feed" is shorthand for something like "feed a new sheet of paper
into the printer" (implicitly meaning that the current page is ejected).

Its effect on printers using continuous paper is less well defined, but
the intent is similar. Its effect on anything else is even less well
defined.
in what situation will I use '\f' ?


Seldom. Depending on the printer type and on the way you access it,
you may want to output it before closing a stream connected to the
printer. If your program doesn't talk directly to the printer, it's
probably not needed at all.

It's most useful to programs that know exactly to what kind of printer
they're talking, so they can decide when it's the right time to move to
a new page (if the decision cannot be left to the printer itself).

Another usage is in plain text files, to divide them into *logical* pages.
There is no guarantee that these logical pages will nicely map into
physical pages when the file is printed, however. When such files are
displayed on the screen, the ASCII FF character is often represented as
^L. You can type it yourself on an ASCII keyboard as CTRL-L.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 13 '05 #3
On 3 Jul 2003 14:14:30 GMT, Da*****@cern.ch (Dan Pop) wrote:
In <be***********@netnews.csie.NCTU.edu.tw> Chun-Chieh Wang <sh***@es01.adm.nctu.edu.tw> writes:
how does the '\f' affect output?


"Form feed" is shorthand for something like "feed a new sheet of paper
into the printer" (implicitly meaning that the current page is ejected).

Its effect on printers using continuous paper is less well defined, but
the intent is similar. Its effect on anything else is even less well
defined.


Cutsheet printers are a much more recent invention than the form-feed character
is. On mainframe line printers (continious paper printers), the form-feed
character typically caused the printer to advance the paper to the top of the
next page (delimited by the perforations that seperated one page from another,
and governed by a 'print control tape' or 'print control chain' or even a
"UCB"). Even on my old ASR33 printer (with pin feed), the form-feed character
caused the printer to advance to (what it considered to be) the top of the page
(in this case, governed by a metal setpost on a cam, mounted on the pinfeed
drive).

In any case, the '\f' sequencee in C does none of these things; it simply causes
the compiler to substitute the appropriate form-feed character (or character
sequence) (in the hosted characterset) into the data stream. /How/ that
form-feed character (or sequence) is interpreted is undefined to C, and could
cause the launching of an ICBM instead of the advancement of a piece of paper
(should the external environment interpret it in that manner).
--
Lew Pitcher
IT Consultant, Enterprise Technology Solutions
Toronto Dominion Bank Financial Group

(Opinions expressed are my own, not my employers')
Nov 13 '05 #4
On Thu, 3 Jul 2003, Chun-Chieh Wang wrote:
how does the '\f' affect output?
in what situation will I use '\f' ?


The '\f' character is a form feed. It moves the active position to the
start of the next logical page. If you are sending it to a cut sheet
printer it might make the printer eject the current sheet. If it is to a
continuous feed printer it might make the printer advance to the next
perforation mark on the roll. If there is no performation mark then it
will advance to whatever the printer driver detemines is the start of the
next page.

Beyond the examples given, it is really open to interpretation. I could
program my terminal display such that a form feed means clear the screen.

Obviously since it comes from the days when output went to a teletype or
printer, it really only makes sense when you are outputting to a printer.
Even then, output to a printer tends to be unportable so you wouldn't
necessarily use stdio. So, realistically, you might never use '\f'
character. Last time I used it was some 15 or 20 years ago.

--
main(){int j=1234;char t[]=":@abcdefghijklmnopqrstuvwxyz.\n",*i=
"iqgbgxmdbjlgdv.lksrqek.n";char *strchr(const char *,int);while(
*i){j+=strchr(t,*i++)-t;j%=sizeof t-1;putchar(t[j]);} return 0;}

Nov 13 '05 #5
On 3 Jul 2003 12:52:27 GMT, in comp.lang.c , "Mark A. Odell"
<no****@embeddedfw.com> wrote:
Chun-Chieh Wang <sh***@es01.adm.nctu.edu.tw> wrote in
news:be***********@netnews.csie.NCTU.edu.tw:
how does the '\f' affect output?
in what situation will I use '\f' ?


If sent to a printer, it *might* eject the current page. If sent to a
terminal window, it might push the text up some number of lines.


and it might also print either a little arrow with an f next to it, or
a looking-glass (windows apps do both of these, when the mood takes
them).

All of these are possible, because the interpretation of escape
sequences is implementation defined.

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 13 '05 #6
On Thu, 3 Jul 2003 12:44:29 UTC, Chun-Chieh Wang
<sh***@es01.adm.nctu.edu.tw> wrote:
how does the '\f' affect output?
in what situation will I use '\f' ?

Every time you knows that you doesn't print to a real endless stream
of bytes, but to a (series) of forms. '\f' tells the driver that the
current form is finished and that another should be made ready. If you
prints to a screen, the scrren gets cleard, if you prints to a card
puncher the current card gets released and the next one positioned so
that the next print will start at column one, if you prints to a
printer the current page gets removed from the printer and the next
one gets inserted so that the first logical printable line gets
presented, if you prints to a file that is formed as something a
printer driver (e.g. postcript or hpgl or something else) will know
what it has to do when it gets the page presented to put it out to its
device.

To make it short, on text streams (binary streams will always ignore
any special meaning):
- '\n' closes a line
- '\f' closes a page
- '\t' prints a tab wide spaces (whereas the definition of the tab
depends on the driver attached to the stream.)
- '\b' lets the logical cursor go a char backwards
whereas this cursor may be a the cursor on screen, the printhead,
a pinter inside the print buffer on the device or the driver....
- '\a' may ring a bell, a siren, or another device that
does require the attention of the operator or even does nothing when
no device that can be activated on that signal gets activated.
On a PC it will give traditionally a signal to the speaker or
play a wave file through the soudcard - or even do nothing or
something else.
This depends completely on the driver that receives the stream.

There are more special defined charachters to modify the stream in
shorthand or with special meaning.

So a C programm has many possibilities to modify the visible result
often without knowing which device is attached to it.

--
Tschau/Bye

Herbert Rosenau
http://www.pc-rosenau.de eComStation Reseller in Germany
eCS 1.1 GA englisch wird jetzt ausgeliefert
Nov 13 '05 #7

Chun-Chieh Wang <sh***@es01.adm.nctu.edu.tw> wrote in message
news:be***********@netnews.csie.NCTU.edu.tw...
how does the '\f' affect output?
That depends upon the target device.
in what situation will I use '\f' ?


When the device to which you have a stream
attached has assigned a particular meaning
to '\f' which you find useful. Example:
some printers will eject a page when receiving
a '\f' character.

Depending upon the applications you write, you
might indeed never use '\f'. It's been a long
while since I've used it myself.

-Mike


Nov 13 '05 #8
Le*********@td.com (Lew Pitcher) writes:
In any case, the '\f' sequencee in C does none of these things; it simply causes
the compiler to substitute the appropriate form-feed character (or character
sequence) (in the hosted characterset) into the data stream. /How/ that
form-feed character (or sequence) is interpreted is undefined to C, and could
cause the launching of an ICBM instead of the advancement of a piece of paper
(should the external environment interpret it in that manner).


As could any character, including plain old ordinary printable
characters, etc., as the interpretation of a character by the host
environment is completely outside of the scope of the C language (and
its standard). However, the standard does put forth the *intended*
interpretation for "\f", so I think we're pretty safe for that :-)

-Micah
Nov 13 '05 #9

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

Similar topics

2
by: thecrow | last post by:
Alright, what the hell is going on here? In the following code, I expect the printed result to be: DEBUG: frank's last name is burns. Instead, what I get is: DEBUG: frank's last name is...
220
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have...
699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
92
by: Reed L. O'Brien | last post by:
I see rotor was removed for 2.4 and the docs say use an AES module provided separately... Is there a standard module that works alike or an AES module that works alike but with better encryption?...
137
by: Philippe C. Martin | last post by:
I apologize in advance for launching this post but I might get enlightment somehow (PS: I am _very_ agnostic ;-). - 1) I do not consider my intelligence/education above average - 2) I am very...
5
by: PW | last post by:
I'm creating an ASP to print labels for a client. How do you send a formfeed to the printer ?
12
by: Dario | last post by:
The following simple program behaves differently in Windows and Linux . #include <stdexcept> #include <iostream> #include <string> using namespace std; class LogicError : public logic_error {...
4
by: Greenhorn | last post by:
Hi, Can i know how formfeed exactly works, also vertical tab, i have used vertical tab with printf() as shown below: printf("This is the \v line"); the output: This is the ♂ line
1
by: Dave Cullen | last post by:
How do I force a new page when printing with PrintDocument? I put a vbFormFeed in there after my footer and it gets ignored. Thanks Dave
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.