Thread: terminal window size

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    4

    terminal window size

    Ive been trying to find how to make a c program what changes he size of the terminal window. I tried with google with no results

    i'm actually trying to make my program to be able to get this information as command line parameters.. e.g myprogram -x 10 -y 5

    i'm using linux + gcc.

    Any ideas?

    Thanks,

    8Ball

  2. #2
    Registered User
    Join Date
    Apr 2008
    Posts
    396
    do you mean to change the geometry of the window? which terminal? most graphic terminal on an unix-like system have this builtin option (-g 100x100+5+5 for instance). If you want to program it, you need in particular the XMoveResizeWindow() Xlib call (plus all the init code and the window id lookup).

  3. #3
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    What is a "terminal window"?
    Are you talking about re-sizing an Xterm window running under X?

    gg

  4. #4
    Registered User
    Join Date
    Apr 2008
    Posts
    4
    i mean a terminal emulator window like putty.. i'd like to be able to resize the number of lines there are in the window directly from my program. sorry for my poor english...

  5. #5
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Whichever terminal-type being emulated will have to support the concept of being resized - and the emulator itself would need to recognize this and resize its X window.

    With all that in place, my first attempt would be to run "stty cols N rows N".

    gg

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by eight8ball View Post
    i mean a terminal emulator window like putty.. i'd like to be able to resize the number of lines there are in the window directly from my program. sorry for my poor english...
    You almost certainly can not resize the Windows Console (CMD) from your Linux/Unix application. If you are forwarding X-windows applications over SSH via PuTTY, then you could resize the X term window on Windows using the method described above. But Windows itself is responsible for the Console windows, and they aren't "available" to a Linux/Unix machine in any way shape or form.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Just starting Windows Programming, School me!
    By Shamino in forum Windows Programming
    Replies: 17
    Last Post: 02-22-2008, 08:14 AM
  2. Why only 32x32? (OpenGL) [Please help]
    By Queatrix in forum Game Programming
    Replies: 2
    Last Post: 01-23-2006, 02:39 PM
  3. Adding colour & bmps to a Win 32 Window??
    By carey_sizer in forum Windows Programming
    Replies: 4
    Last Post: 09-04-2004, 05:55 PM
  4. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 10:01 PM
  5. Invoking MSWord
    By Donn in forum C Programming
    Replies: 21
    Last Post: 09-08-2001, 04:08 PM