screen scrolling

Hi, i'm writing code that dumps the contents of a text file into a buffer and then displays on screen in a text window with cprintf (turbo C) I want to be able to scroll through the entire buffer one window at a time. Anyone have any hints on how to accomplish this?

Comments

  • : Hi, i'm writing code that dumps the contents of a text file into a buffer and then displays on screen in a text window with cprintf (turbo C) I want to be able to scroll through the entire buffer one window at a time. Anyone have any hints on how to accomplish this?
    :
    [blue]The first thing is how big is the file? Turbo C can 'lift' around 500Kb - no more, so if the file size is counted by Mbytes, then you need to read the file, but not load it into memory, but just store in the huge array the [b]long[/b] offsets to lines and then display 24 lines per screen. Write a function to display a page and pass to it a line at the top of screen. Changing this parameter (using keyboard) will show the page from any line number, which should produce scrolling effect. I once have written that - long ago.[/blue]
  • : : Hi, i'm writing code that dumps the contents of a text file into a buffer and then displays on screen in a text window with cprintf (turbo C) I want to be able to scroll through the entire buffer one window at a time. Anyone have any hints on how to accomplish this?
    : :
    : [blue]The first thing is how big is the file? Turbo C can 'lift' around 500Kb - no more, so if the file size is counted by Mbytes, then you need to read the file, but not load it into memory, but just store in the huge array the [b]long[/b] offsets to lines and then display 24 lines per screen. Write a function to display a page and pass to it a line at the top of screen. Changing this parameter (using keyboard) will show the page from any line number, which should produce scrolling effect. I once have written that - long ago.[/blue]
    :
    Oh no, i'm going to put a 64k ceiling on the file sizes, that should be plenty. Your idea sounds good, but i was hoping to use a built in feature of the conio functions to simplify. I will try your suggestions though, thanks.
  • : : : Hi, i'm writing code that dumps the contents of a text file into a buffer and then displays on screen in a text window with cprintf (turbo C) I want to be able to scroll through the entire buffer one window at a time. Anyone have any hints on how to accomplish this?
    : : :
    : : [blue]The first thing is how big is the file? Turbo C can 'lift' around 500Kb - no more, so if the file size is counted by Mbytes, then you need to read the file, but not load it into memory, but just store in the huge array the [b]long[/b] offsets to lines and then display 24 lines per screen. Write a function to display a page and pass to it a line at the top of screen. Changing this parameter (using keyboard) will show the page from any line number, which should produce scrolling effect. I once have written that - long ago.[/blue]
    : :
    : Oh no, i'm going to put a 64k ceiling on the file sizes, that should be plenty. Your idea sounds good, but i was hoping to use a built in feature of the conio functions to simplify. I will try your suggestions though, thanks.
    :
    [blue]I see... so for such small file size you will be fine to load the whole thing in memory. One thing: I am not sure that conio has any features for scrolling - only insline/delline functions, but you need a bigger picture here. What if you want to scroll by the whole page? Using 24 times delline and the redrawing all these lines will be not very fast. Better way will be clrscr and the redraw whole screen.[/blue]
  • : :
    : [blue]I see... so for such small file size you will be fine to load the whole thing in memory. One thing: I am not sure that conio has any features for scrolling - only insline/delline functions, but you need a bigger picture here. What if you want to scroll by the whole page? Using 24 times delline and the redrawing all these lines will be not very fast. Better way will be clrscr and the redraw whole screen.[/blue]
    :


    There is an MS-DOS interrupt (int 10h) that will scroll the screen either up or down by desired number of lines and works extremly fast.
  • : : : : Hi, i'm writing code that dumps the contents of a text file into a buffer and then displays on screen in a text window with cprintf (turbo C) I want to be able to scroll through the entire buffer one window at a time. Anyone have any hints on how to accomplish this?
    : : : :
    : : : [blue]The first thing is how big is the file? Turbo C can 'lift' around 500Kb - no more, so if the file size is counted by Mbytes, then you need to read the file, but not load it into memory, but just store in the huge array the [b]long[/b] offsets to lines and then display 24 lines per screen. Write a function to display a page and pass to it a line at the top of screen. Changing this parameter (using keyboard) will show the page from any line number, which should produce scrolling effect. I once have written that - long ago.[/blue]
    : : :
    : : Oh no, i'm going to put a 64k ceiling on the file sizes, that should be plenty. Your idea sounds good, but i was hoping to use a built in feature of the conio functions to simplify. I will try your suggestions though, thanks.
    : :
    : [blue]I see... so for such small file size you will be fine to load the whole thing in memory. One thing: I am not sure that conio has any features for scrolling - only insline/delline functions, but you need a bigger picture here. What if you want to scroll by the whole page? Using 24 times delline and the redrawing all these lines will be not very fast. Better way will be clrscr and the redraw whole screen.[/blue]
    :

    Yeah, i had a feeling there was no specific scrolling functions. I am going to try the ins/del line from buffer thing.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories