<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0">
<channel>
  <title>Linux Format forums</title>
  <link>http://www.linuxformat.com/forums/index.php</link>
  <description>Help, discussion, magazine feedback and more</description>
  <language>english</language>
  <copyright>(c) Copyright Sat May 25, 2013 9:20 am by Linux Format forums</copyright>
  <managingEditor>webmaster@linuxformat.com</managingEditor>
  <webMaster>webmaster@linuxformat.com</webMaster>
  <pubDate>Sat May 25, 2013 9:20 am</pubDate>
  <lastBuildDate>Sat May 25, 2013 9:20 am</lastBuildDate>
  <docs>http://backend.userland.com/rss</docs>
  <generator>phpBB2 RSS Syndication Mod by Lucas</generator>
  <ttl>1</ttl>

  <image>
    <title>Linux Format forums</title>
    <url></url>
    <link>http://www.linuxformat.com/forums/</link>
    <description>Help, discussion, magazine feedback and more</description>
  </image>

                                      <item>
                                        <title>g++ ncurses help</title>
                                        <link>http://www.linuxformat.com/forums/viewtopic.php?p=30876#30876</link>
                                        <description>&lt;br /&gt;
                                      Author: &lt;a href='http://www.linuxformat.com/forums/profile.php?mode=viewprofile&amp;u=9246'&gt;fpga&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      Posted: Tue Sep 12, 2006 9:19 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      &lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;&lt;br /&gt;
#include &amp;lt;curses.h&amp;gt;&lt;br /&gt;
/* &lt;br /&gt;
run this code as is, noting that all 'sets' print out correctly with their right edges aligned at x=15.&lt;br /&gt;
&lt;br /&gt;
Then change PROBLEM's value to 1 and re-run.&lt;br /&gt;
&lt;br /&gt;
Why does changing b2's 'capacity' to 9 cause it to start printing out&lt;br /&gt;
at a position other than x=15?&lt;br /&gt;
&lt;br /&gt;
If I make b2's capacity 8 or 10 I don't get a problem.&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;br /&gt;
Any help in explaining the right shift and how to stop it would be most&lt;br /&gt;
appreciated.&lt;br /&gt;
Best regards&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
#define PROBLEM 0&amp;nbsp; &amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
//=============================================&lt;br /&gt;
class SetupPad &amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;public&amp;#58;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; WINDOW * ptr; //ie pPad&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; SetupPad&amp;#40;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; ~SetupPad&amp;#40;&amp;#41; &amp;#123; delwin&amp;#40;ptr&amp;#41;; endwin&amp;#40;&amp;#41;; &amp;#125;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; void linesCols&amp;#40;&amp;#41;; &lt;br /&gt;
&amp;#125;;&lt;br /&gt;
&lt;br /&gt;
SetupPad&amp;#58;&amp;#58;SetupPad&amp;#40;&amp;#41;&lt;br /&gt;
&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;initscr&amp;#40;&amp;#41;;&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp;curs_set&amp;#40;0&amp;#41;;&lt;br /&gt;
&amp;#125;;&lt;br /&gt;
&lt;br /&gt;
void SetupPad&amp;#58;&amp;#58;linesCols&amp;#40;&amp;#41;&lt;br /&gt;
&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;ptr = newpad&amp;#40;LINES-1,COLS-1&amp;#41;;&lt;br /&gt;
&amp;#125;&lt;br /&gt;
//=============================================&lt;br /&gt;
class Set&lt;br /&gt;
&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;public&amp;#58;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;int x,y,cap;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Set&amp;#40;int nx,int ny, int ncap&amp;#41; &amp;#58; x&amp;#40;nx&amp;#41;,y&amp;#40;ny&amp;#41;,cap&amp;#40;ncap&amp;#41; &amp;#123;&amp;#125;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;~Set&amp;#40;&amp;#41;&amp;#123;&amp;#125;&amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;#125;;&lt;br /&gt;
//=============================================&lt;br /&gt;
void drawQ&amp;#40;Set * pS,WINDOW * pWin&amp;#41; &lt;br /&gt;
&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;int x=pS-&amp;gt;x;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;int y=pS-&amp;gt;y;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;char sym = '.';&lt;br /&gt;
&amp;nbsp; &amp;nbsp;for &amp;#40;int j=0;j&amp;lt;pS-&amp;gt;cap;j++&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;mvwaddch&amp;#40;pWin, y, x--, sym&amp;#41;;&lt;br /&gt;
&amp;#125;&lt;br /&gt;
&lt;br /&gt;
void updtScn&amp;#40;SetupPad * pPad&amp;#41;&lt;br /&gt;
&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;prefresh&amp;#40;pPad-&amp;gt;ptr,0,0,0,0,LINES-1,COLS-1&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;doupdate&amp;#40;&amp;#41;;&lt;br /&gt;
&amp;#125;&lt;br /&gt;
&lt;br /&gt;
int main&amp;#40;&amp;#41; &lt;br /&gt;
&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;SetupPad pad;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;pad.linesCols&amp;#40;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Set b1&amp;#40;15,1,13&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Set m1&amp;#40;15,2,10&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Set m2&amp;#40;15,3,10&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
#if PROBLEM&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Set b2&amp;#40;15,4,9&amp;#41;;&lt;br /&gt;
#else&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Set b2&amp;#40;15,4,10&amp;#41;;&amp;nbsp; &amp;nbsp;//works with 8 too!&lt;br /&gt;
#endif&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;drawQ&amp;#40;&amp;amp;b1,pad.ptr&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;drawQ&amp;#40;&amp;amp;m1,pad.ptr&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;drawQ&amp;#40;&amp;amp;m2,pad.ptr&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;drawQ&amp;#40;&amp;amp;b2,pad.ptr&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;updtScn&amp;#40;&amp;amp;pad&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;for &amp;#40;int i=0;i&amp;lt;1000000000;i++&amp;#41;; //delay so you can see it &lt;br /&gt;
&amp;nbsp; &amp;nbsp;return 0;&lt;br /&gt;
&amp;#125;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;</description>
                                        <comments>http://www.linuxformat.com/forums/viewtopic.php?p=30876#30876</comments>
                                        <author>fpga</author>
                                        <pubDate>Tue Sep 12, 2006 9:19 am</pubDate>
                                        <guid isPermaLink="true">http://www.linuxformat.com/forums/viewtopic.php?p=30876#30876</guid>
                                      </item></channel></rss>