Marquee implementation in C

Discussion in 'C Programming' started by praveen, Oct 7, 2007.

  1. praveen

    praveen Guest

    Hi,

    I want to scroll the text horizontally up to maximum of 50 characters
    without using widgets.
    How can i scroll the text ?
    Give code snippet for this marquee implementation using C.

    Thanks&Regards,
    Rahul.
    praveen, Oct 7, 2007
    #1
    1. Advertising

  2. praveen

    Ian Collins Guest

    praveen wrote:
    > Hi,
    >
    > I want to scroll the text horizontally up to maximum of 50 characters
    > without using widgets.


    This isn't the place to ask, try a group dedicated to your operating system.

    --
    Ian Collins.
    Ian Collins, Oct 7, 2007
    #2
    1. Advertising

  3. praveen

    Ian Collins Guest

    Ian Collins wrote:
    > praveen wrote:
    >> Hi,
    >>
    >> I want to scroll the text horizontally up to maximum of 50 characters
    >> without using widgets.

    >
    > This isn't the place to ask, try a group dedicated to your operating system.
    >

    Although I guess you could simply use puts in a loop.

    --
    Ian Collins.
    Ian Collins, Oct 7, 2007
    #3
  4. praveen

    santosh Guest

    Ian Collins wrote:

    > Ian Collins wrote:
    >> praveen wrote:
    >>> Hi,
    >>>
    >>> I want to scroll the text horizontally up to maximum of 50
    >>> characters without using widgets.

    >>
    >> This isn't the place to ask, try a group dedicated to your operating
    >> system.
    >>

    > Although I guess you could simply use puts in a loop.


    I don't think it's possible without some dependence on implementation
    defined behaviour. The easiest solution would be use some similar to
    curses.
    santosh, Oct 7, 2007
    #4
  5. santosh <> writes:
    > Ian Collins wrote:
    >> Ian Collins wrote:
    >>> praveen wrote:
    >>>> I want to scroll the text horizontally up to maximum of 50
    >>>> characters without using widgets.
    >>>
    >>> This isn't the place to ask, try a group dedicated to your operating
    >>> system.
    >>>

    >> Although I guess you could simply use puts in a loop.

    >
    > I don't think it's possible without some dependence on implementation
    > defined behaviour. The easiest solution would be use some similar to
    > curses.


    It can be done if the carriage return character behaves as specified.
    But I'm unwilling to do the OP's homework for him.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
    Keith Thompson, Oct 7, 2007
    #5
  6. praveen

    santosh Guest

    Keith Thompson wrote:

    > santosh <> writes:
    >> Ian Collins wrote:
    >>> Ian Collins wrote:
    >>>> praveen wrote:
    >>>>> I want to scroll the text horizontally up to maximum of 50
    >>>>> characters without using widgets.
    >>>>
    >>>> This isn't the place to ask, try a group dedicated to your
    >>>> operating system.
    >>>>
    >>> Although I guess you could simply use puts in a loop.

    >>
    >> I don't think it's possible without some dependence on implementation
    >> defined behaviour. The easiest solution would be use some similar to
    >> curses.

    >
    > It can be done if the carriage return character behaves as specified.
    > But I'm unwilling to do the OP's homework for him.


    Since that behaviour is unspecified the program, correct me if I'm
    wrong, would depend on implementation specified behavior.

    Also the OP has not specified exactly what he means by "scroll."
    santosh, Oct 7, 2007
    #6
  7. santosh <> writes:
    > Keith Thompson wrote:
    >> santosh <> writes:
    >>> Ian Collins wrote:
    >>>> Ian Collins wrote:
    >>>>> praveen wrote:
    >>>>>> I want to scroll the text horizontally up to maximum of 50
    >>>>>> characters without using widgets.
    >>>>>
    >>>>> This isn't the place to ask, try a group dedicated to your
    >>>>> operating system.
    >>>>>
    >>>> Although I guess you could simply use puts in a loop.
    >>>
    >>> I don't think it's possible without some dependence on implementation
    >>> defined behaviour. The easiest solution would be use some similar to
    >>> curses.

    >>
    >> It can be done if the carriage return character behaves as specified.
    >> But I'm unwilling to do the OP's homework for him.

    >
    > Since that behaviour is unspecified the program, correct me if I'm
    > wrong, would depend on implementation specified behavior.


    C99 5.2.2p2 "Character display semantics":

    Alphabetic escape sequences representing nongraphic characters in
    the execution character set are intended to produce actions on
    display devices as follows:

    ...

    \r (carriage return) Moves the active position to the initial
    position of the current line.

    The weasel wording "are intended to" allows for considerable
    variation, of course. For example, most of the terminal emulators I
    use ignore the form feed character.

    > Also the OP has not specified exactly what he means by "scroll."


    True.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
    Keith Thompson, Oct 7, 2007
    #7
  8. praveen

    Martin Wells Guest

    On Oct 7, 7:55 am, Ian Collins <> wrote:
    > praveen wrote:
    > > Hi,

    >
    > > I want to scroll the text horizontally up to maximum of 50 characters
    > > without using widgets.

    >
    > This isn't the place to ask, try a group dedicated to your operating system.



    #define WIDGET_USAGE 0

    #define MAX_SCROLL_CHAR 50

    #include <stdio.h>

    void Scroll(char const *str)
    {
    while (*str++)
    {
    puts(stdin,getsInLen(), MAX_SCROLL_CHAR);
    }
    }


    Make sure you define "MAX_SCROLL_CHAR" before you include stdio.h.

    Martin
    Martin Wells, Oct 7, 2007
    #8
  9. praveen

    Coos Haak Guest

    Op Sun, 07 Oct 2007 15:37:54 -0700 schreef Martin Wells:

    > On Oct 7, 7:55 am, Ian Collins <> wrote:
    >> praveen wrote:
    >>> Hi,

    >>
    >>> I want to scroll the text horizontally up to maximum of 50 characters
    >>> without using widgets.

    >>
    >> This isn't the place to ask, try a group dedicated to your operating system.

    >
    >
    > #define WIDGET_USAGE 0
    >
    > #define MAX_SCROLL_CHAR 50
    >
    > #include <stdio.h>
    >
    > void Scroll(char const *str)
    > {
    > while (*str++)
    > {
    > puts(stdin,getsInLen(), MAX_SCROLL_CHAR);
    > }
    > }
    >
    >
    > Make sure you define "MAX_SCROLL_CHAR" before you include stdio.h.
    >

    How did you learn C, from the Dead C scrolls perhaps ;-(
    --
    Coos
    Coos Haak, Oct 8, 2007
    #9
  10. [comp.lang.c] santosh <> wrote:

    >>> praveen wrote:
    >>>>
    >>>> I want to scroll the text horizontally up to maximum of 50
    >>>> characters without using widgets.


    > I don't think it's possible without some dependence on implementation
    > defined behaviour. The easiest solution would be use some similar to
    > curses.


    Obviously curses is probably the "right" answer, but one could hack
    together something standard that might meet the letter of the
    requirements, assuming knowledge of the number of columns and lines on
    the terminal window and busy waiting to moderate the screen "redraw"
    rate.

    --
    C. Benson Manica | I appreciate all corrections, polite or otherwise.
    cbmanica(at)gmail.com |
    ----------------------| I do not currently read any posts posted through
    sdf.lonestar.org | Google groups, due to rampant unchecked spam.
    Christopher Benson-Manica, Oct 8, 2007
    #10
  11. On Sun, 07 Oct 2007 02:08:15 -0700, Keith Thompson <>
    wrote:

    > santosh <> writes:
    > > Ian Collins wrote:
    > >> Ian Collins wrote:
    > >>> praveen wrote:
    > >>>> I want to scroll the text horizontally up to maximum of 50
    > >>>> characters without using widgets.
    > >>>
    > >>> This isn't the place to ask, try a group dedicated to your operating
    > >>> system.
    > >>>
    > >> Although I guess you could simply use puts in a loop.

    > >
    > > I don't think it's possible without some dependence on implementation
    > > defined behaviour. The easiest solution would be use some similar to
    > > curses.

    >
    > It can be done if the carriage return character behaves as specified.
    > But I'm unwilling to do the OP's homework for him.


    If CR behaves as sortof-almost-specified, AND 'overwriting' a line
    works as you apparently expect but which is not even suggested by the
    Standard. On some, formerly common, devices it can't. On modern
    bitmapped displays it would be reasonable to ior the bitmaps to
    simulate traditional over_printing_. It would be legal to xor the
    bitmaps, and I think I might even come up with a plausible rationale
    to do so. It would even be legal to combine the two character _codes_
    and use the result as a single new extended code, probably
    Unicode/10646 assuming the narrow codes are ASCII or ASCII-like.

    And if one doesn't want 'continous' aka 'gradual' scrolling, nor
    scrolling at a rate (or rates) more precise than the
    implementation-dependent approximation of time() et al.

    And if the output (device) supports sufficiently long lines, here 50
    characters, which similarly is only sortof-almost-specified.

    - formerly david.thompson1 || achar(64) || worldnet.att.net
    David Thompson, Oct 22, 2007
    #11
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. et

    Marquee with a dataset?

    et, Oct 17, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,244
    Mark Rae
    Oct 17, 2004
  2. =?Utf-8?B?QWxp?=

    Marquee from database

    =?Utf-8?B?QWxp?=, Apr 6, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    4,973
    James Steele
    Apr 6, 2005
  3. =?Utf-8?B?RGFuaWVs?=

    how to use marquee in asp.net?

    =?Utf-8?B?RGFuaWVs?=, Oct 4, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    29,482
    Mark Rae
    Oct 6, 2005
  4. =?Utf-8?B?TWFyZWsgRw==?=

    MARQUEE

    =?Utf-8?B?TWFyZWsgRw==?=, Feb 20, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    811
    Mark Rae
    Feb 20, 2006
  5. UJ

    Transparent items marquee?

    UJ, Apr 25, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    1,138
Loading...

Share This Page