LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 07-01-2010, 08:37 AM   #1
karatelambda
LQ Newbie
 
Registered: Jul 2010
Posts: 4

Rep: Reputation: 0
get console window width: why ioctl always return 0 width?


Hi, all,
I use ioctl to get the cosole window size (the SSH window). I use the following code:

-------------
struct winsize ws;
int returnValue = ioctl(pCommandStructure->terminal, TIOCGWINSZ, &ws);
int numberOfColumnsOfTerminalWindow = ws.ws_col;
-------------

When I debug on linux pc, it gives me the correct window width. But after I try it on router (this is my enventual place where my code shall run), ioctl always give me 0 width, that is, numberOfColumnsOfTerminalWindow == 0. but the returnValue is 0 which means that the function call succeeds.

Can anyonen tell me what is the problem and how to solve it?

Thanks a lot.
 
Old 07-02-2010, 12:08 PM   #2
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 248Reputation: 248Reputation: 248
There is no window on the router. So it will always be 0 width. Unless you have some kind of GUI running on the router ?
 
Old 07-07-2010, 07:57 AM   #3
karatelambda
LQ Newbie
 
Registered: Jul 2010
Posts: 4

Original Poster
Rep: Reputation: 0
Thank you for reply. I use PuTTY to login to this router. I mean the window size of this console window. Any idea?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Get width/height of a terminal window in c++? rohedin Programming 9 10-24-2012 07:00 PM
Adjust table width so that it fits to page width ynovh Programming 2 03-22-2010 03:13 PM
gnome-terminal and console column width jhwilliams Linux - Software 3 08-16-2007 10:22 PM
Set text (runlevel 3) console character width davee Linux - Newbie 2 11-16-2003 03:33 PM
Scripting question: the width of the terminal window Bebo Programming 13 11-06-2003 04:41 PM


All times are GMT -5. The time now is 05:00 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration