<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Regarding char pointer in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-char-pointer/m-p/3874437#M773889</link>
    <description>You might post something which is possible to&lt;BR /&gt;compile and run.  Without line numbers.  You&lt;BR /&gt;know, an actual program?&lt;BR /&gt;&lt;BR /&gt;Even better, include the commands you used to&lt;BR /&gt;compile/link your test program, and an actual&lt;BR /&gt;transcript showing how you ran it, and what&lt;BR /&gt;happened when you ran it.</description>
    <pubDate>Thu, 05 Oct 2006 05:20:37 GMT</pubDate>
    <dc:creator>Steven Schweda</dc:creator>
    <dc:date>2006-10-05T05:20:37Z</dc:date>
    <item>
      <title>Regarding char pointer</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-char-pointer/m-p/3874431#M773883</link>
      <description>My C program is running under HP-UX 10.2&lt;BR /&gt;&lt;BR /&gt;char *rc = NULL&lt;BR /&gt;&lt;BR /&gt;short *dt;&lt;BR /&gt;*dt=1;&lt;BR /&gt;&lt;BR /&gt;switch (*dt)&lt;BR /&gt;{&lt;BR /&gt; case 1:&lt;BR /&gt;  rc="Intertoll"&lt;BR /&gt;  break;&lt;BR /&gt; case 2:&lt;BR /&gt;  rc="LocalExchange"&lt;BR /&gt;  break;&lt;BR /&gt; case 3:&lt;BR /&gt;  rc="other"&lt;BR /&gt;  break;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Printf("%s",rc);&lt;BR /&gt;&lt;BR /&gt;The output is display as "other" even when dt is 1. It should have displayed as intertoll I had pasted an sample piece of code from my application. I don't know why char pointer rc is showing an incorrect value event if dt is correct.&lt;BR /&gt;Dont know is there a problem with char pointer?</description>
      <pubDate>Wed, 04 Oct 2006 13:11:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-char-pointer/m-p/3874431#M773883</guid>
      <dc:creator>vind123</dc:creator>
      <dc:date>2006-10-04T13:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding char pointer</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-char-pointer/m-p/3874432#M773884</link>
      <description>&lt;!--!*#--&gt;!.  That's not a C program.&lt;BR /&gt;&lt;BR /&gt;2.  If it were, then "dt" would be a pointer&lt;BR /&gt;to nowhere.  Declaring a pointer does not&lt;BR /&gt;create the storage to which it points.&lt;BR /&gt;&lt;BR /&gt;3.  If the pointer "dt" actually pointed to&lt;BR /&gt;some storage, then it might have worked&lt;BR /&gt;as you expected.  That is, for example,&lt;BR /&gt;insert:&lt;BR /&gt;&lt;BR /&gt;short dt_real;  /* Allocate a short. */&lt;BR /&gt;dt = &amp;amp;dt_real;  /* Point "dt" to it. */&lt;BR /&gt;&lt;BR /&gt;after "short *dt;".</description>
      <pubDate>Wed, 04 Oct 2006 13:31:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-char-pointer/m-p/3874432#M773884</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2006-10-04T13:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding char pointer</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-char-pointer/m-p/3874433#M773885</link>
      <description>&lt;!--!*#--&gt;You cannot initialize a pointer to the value of a variable. It can be initialized (or made to point to an object) by getting the address of the object. Once the pointer variable points to an object then you can dereference it i.e.&lt;BR /&gt;&lt;BR /&gt;short x, *ip&lt;BR /&gt;x = 1;&lt;BR /&gt;*ip = 1; /* wrong use of pointer */&lt;BR /&gt;ip = &amp;amp;x; /* correct */&lt;BR /&gt;*ip = 10; /* x in now equal to 10 since *ip is the same as x */&lt;BR /&gt;</description>
      <pubDate>Wed, 04 Oct 2006 13:45:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-char-pointer/m-p/3874433#M773885</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-10-04T13:45:26Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding char pointer</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-char-pointer/m-p/3874434#M773886</link>
      <description>Apologies i posted the incorrect info about dt. dt is fine. It happens to be correct only.&lt;BR /&gt;char *rc = NULL&lt;BR /&gt;short val;&lt;BR /&gt;val=1;&lt;BR /&gt;short *dt;&lt;BR /&gt;dt=&amp;amp;val;&lt;BR /&gt;switch (*dt)&lt;BR /&gt;{&lt;BR /&gt;case 1:&lt;BR /&gt;rc="Intertoll"&lt;BR /&gt;break;&lt;BR /&gt;case 2:&lt;BR /&gt;rc="LocalExchange"&lt;BR /&gt;break;&lt;BR /&gt;case 3:&lt;BR /&gt;rc="other"&lt;BR /&gt;break;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Printf("%s",rc);&lt;BR /&gt;&lt;BR /&gt; rc is not getting stored as "intertoll", it's getting stored as "other".  I did a printf statement on  the rc in the switch case after rc="intertoll" and it shows an incorrect value. It's going to case 1 only.  Just wondering whether char pointer has some problems if we assign directly. I will try to get a snapshot from the real code after some time. I had pasted the how it appears in the real above&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 05 Oct 2006 02:40:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-char-pointer/m-p/3874434#M773886</guid>
      <dc:creator>vind123</dc:creator>
      <dc:date>2006-10-05T02:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding char pointer</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-char-pointer/m-p/3874435#M773887</link>
      <description>&amp;gt;Apologies i posted the incorrect info about dt. dt is fine. It happens to be correct&lt;BR /&gt;&lt;BR /&gt;Are you sure you'ave posted the correct script this time? Most of your statements are missing the terminating semi-colon and your Printf() starts with an uppercase "P"?&lt;BR /&gt;&lt;BR /&gt;Post the complete code so that it's easier to troubleshoot.&lt;BR /&gt;&lt;BR /&gt;~thanks</description>
      <pubDate>Thu, 05 Oct 2006 03:40:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-char-pointer/m-p/3874435#M773887</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-10-05T03:40:37Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding char pointer</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-char-pointer/m-p/3874436#M773888</link>
      <description>100  static char*&lt;BR /&gt;   101  worker( swclli, a_end_clli, z_end_clli, tfuse, ttm, is_local,&lt;BR /&gt;   102    topas_tfuse, dt_tfuse)&lt;BR /&gt;   103      char *swclli;&lt;BR /&gt;   104      char *a_end_clli;&lt;BR /&gt;   105      char *z_end_clli;&lt;BR /&gt;   106      char *tfuse;&lt;BR /&gt;   107      char *ttm;&lt;BR /&gt;   108      short *is_local;&lt;BR /&gt;   109      short *topas_tfuse;&lt;BR /&gt;   110      short *dt_tfuse;&lt;BR /&gt;   111  {&lt;BR /&gt;   112      int err = 0;&lt;BR /&gt;   113      int warn = 0;&lt;BR /&gt;   114      char *tollClli = "?";&lt;BR /&gt;   115      char *rc = NULL;&lt;BR /&gt;..................&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;   195      if (! err) switch ( *dt_tfuse ) {&lt;BR /&gt;   196          case DT_OWN_INTERTOLL:&lt;BR /&gt;   197              rc = "intertoll";&lt;BR /&gt;   198              break;&lt;BR /&gt;   199&lt;BR /&gt;   200          case DT_OWN_LOCEX:&lt;BR /&gt;   201              rc = "localexchange";&lt;BR /&gt;   202              break;&lt;BR /&gt;   203&lt;BR /&gt;   204          case DT_OWN_NODAL:&lt;BR /&gt;   205              rc = "nodal";&lt;BR /&gt;   206              break;&lt;BR /&gt;   207&lt;BR /&gt;   208          case DT_OWN_INTL:&lt;BR /&gt;   209              rc = "international";&lt;BR /&gt;   210              break;&lt;BR /&gt;   211&lt;BR /&gt;   212          case DT_OWN_ADJUNCT:&lt;BR /&gt;   213              rc = "adjunct";&lt;BR /&gt;   214              break;&lt;BR /&gt;   215&lt;BR /&gt;   216          case DT_OWN_LOCALUSE:&lt;BR /&gt;   217              rc = "localuse";&lt;BR /&gt;   218              break;&lt;BR /&gt;   219&lt;BR /&gt;   220          case DT_OWN_OTHER:&lt;BR /&gt;   221              rc = "other";&lt;BR /&gt;   222              break;&lt;BR /&gt;   223&lt;BR /&gt;   224          default:&lt;BR /&gt;   225              err = __LINE__;&lt;BR /&gt;   226              break;&lt;BR /&gt;   227      }&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;......&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; 241  return rc&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;By Putting trace message i am able to observe *dt_tfuse value is DT_OWN_INTL before coming to switch..case statement.  Also i had put a trace message, to display the rc value after linenumber &lt;BR /&gt; 209              rc = "international"; &lt;BR /&gt;The trace message shows after the execution of line number 209, rc as "other".  Pls post me whether i need to paste the entire function. &lt;BR /&gt;The function has 240 lines so i had pasted a part of it. &lt;BR /&gt;</description>
      <pubDate>Thu, 05 Oct 2006 05:09:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-char-pointer/m-p/3874436#M773888</guid>
      <dc:creator>vind123</dc:creator>
      <dc:date>2006-10-05T05:09:27Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding char pointer</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-char-pointer/m-p/3874437#M773889</link>
      <description>You might post something which is possible to&lt;BR /&gt;compile and run.  Without line numbers.  You&lt;BR /&gt;know, an actual program?&lt;BR /&gt;&lt;BR /&gt;Even better, include the commands you used to&lt;BR /&gt;compile/link your test program, and an actual&lt;BR /&gt;transcript showing how you ran it, and what&lt;BR /&gt;happened when you ran it.</description>
      <pubDate>Thu, 05 Oct 2006 05:20:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-char-pointer/m-p/3874437#M773889</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2006-10-05T05:20:37Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding char pointer</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-char-pointer/m-p/3874438#M773890</link>
      <description>The compilation i will be doing as nmake Makefile.  It has a lot of files along with which i will compile. I am trying to find whether i can detect something thru gdb debugger.&lt;BR /&gt;&lt;BR /&gt;1.I have niOOSdb.ec(embedded C file for query the database)  in my project in which there is a function nigetOOSrptDB. I am unable to keep a breakpoint in this file. If i do a step on the function call nigetOOSrptDB in another c file it's completing the function and getting out. Is it possible to keep a break point in .ec file? Is gdb debugger allows only to keep a breakpoint in c/c++ file.&lt;BR /&gt;&lt;BR /&gt;2. I am trying to display the local variable inside a function inside gdb But i dont know how to display the value of buffer in gdb. It's showing addresses if i do a  (gdb) print path_n_file&lt;BR /&gt;$4 = {d = 0x40217658}&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;(gdb) bt    &lt;BR /&gt;#0  OOSsender::process_sw_clli_det (this=0x402076d0, sw_name=@0x7b03aee8, row_acc=@0x7b03addc) at ../src/niOOSrpt.C:258&lt;BR /&gt;#1  0x15390 in OOSmainRpt (argc=1, input_sw=@0x7b03ad0c) at ../src/OOSrptMain.C:204&lt;BR /&gt;#2  0x13ee0 in main (argc=1, argv=0x7b03aac0) at ../src/OOSrptMain.C:100&lt;BR /&gt;(gdb) frame 0&lt;BR /&gt;#0  OOSsender::process_sw_clli_det (this=0x402076d0, sw_name=@0x7b03aee8, row_acc=@0x7b03addc) at ../src/niOOSrpt.C:258&lt;BR /&gt;258                     int ret = nigetOOSrptDB ( sw_name, (long)(atoi(str_hrs)), &lt;BR /&gt;(gdb) info locals&lt;BR /&gt;ret = 0&lt;BR /&gt;tmp_path_n_file_sum = {d = 0x402174c8}&lt;BR /&gt;__R00e7 = {d = 0x40217518}&lt;BR /&gt;__R00e8 = {d = 0x402174c8, strung = 1 '\001'}&lt;BR /&gt;path_n_file = {d = 0x40217658}&lt;BR /&gt;__R00e2 = {d = 0x40207b28}&lt;BR /&gt;__R00e3 = {d = 0x40217658, strung = 1 '\001'}&lt;BR /&gt;__R00e4 = {d = 0x40217608}&lt;BR /&gt;tmp_path_n_file = {d = 0x40217568}&lt;BR /&gt;__R00e5 = {d = 0x402175b8}&lt;BR /&gt;__R00e6 = {d = 0x40217568, strung = 1 '\001'}&lt;BR /&gt;buffer = {d = 0x402048d8}&lt;BR /&gt;str_outage = {d = 0x402079e8}&lt;BR /&gt;str_hrs = {d = 0x40207648}&lt;BR /&gt;str_row = {d = 0x402048d8}&lt;BR /&gt;str_gaps = {d = 0x4020a060}&lt;BR /&gt;hrs_li = {&lt;CLASS const_listiter=""&gt;&amp;gt; = {&lt;CLASS liztiter_attlc=""&gt; = {theLizt = 0x40207714, nextIt = 0x0, cache = 0x0, &lt;BR /&gt;      cacheNo = 0, index = 1, pred = 0x4020a6a8}, &lt;NO data="https://community.hpe.com/" fields=""&gt;}, &lt;NO data="https://community.hpe.com/" fields=""&gt;}&lt;BR /&gt;row_li = {&lt;CLASS const_listiter=""&gt;&amp;gt; = {&lt;CLASS liztiter_attlc=""&gt; = {theLizt = 0x40207720, nextIt = 0x0, cache = 0x0, &lt;BR /&gt;      cacheNo = 0, index = 0, pred = 0x0}, &lt;NO data="https://community.hpe.com/" fields=""&gt;}, &lt;NO data="https://community.hpe.com/" fields=""&gt;}&lt;BR /&gt;gap_li = {&lt;CLASS const_listiter=""&gt;&amp;gt; = {&lt;CLASS liztiter_attlc=""&gt; = {theLizt = 0x4020772c, nextIt = 0x0, cache = 0x0, &lt;BR /&gt;      cacheNo = 0, index = 1, pred = 0x4020a6f8}, &lt;NO data="https://community.hpe.com/" fields=""&gt;}, &lt;NO data="https://community.hpe.com/" fields=""&gt;}&lt;BR /&gt;out_li = {&lt;CLASS const_listiter=""&gt;&amp;gt; = {&lt;CLASS liztiter_attlc=""&gt; = {theLizt = 0x40207738, nextIt = 0x0, cache = 0x0, &lt;BR /&gt;      cacheNo = 0, index = 1, pred = 0x4020a718}, &lt;NO data="https://community.hpe.com/" fields=""&gt;}, &lt;NO data="https://community.hpe.com/" fields=""&gt;}&lt;BR /&gt;fp_output = (struct FILE *) 0x0&lt;BR /&gt;_result = 62035&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;int&lt;BR /&gt;   212  OOSsender::process_sw_clli_det( const String&amp;amp; sw_name, long &amp;amp;row_acc )&lt;BR /&gt;   213  {&lt;BR /&gt;   214          // generate the detail trunk OOS report and push it&lt;BR /&gt;   215          //     called from from OOSmain() with one switch clli at a time.&lt;BR /&gt;   216&lt;BR /&gt;   217          FILE *fp_output=NULL;&lt;BR /&gt;   218          row_acc=0; // total rows accumulated so far&lt;BR /&gt;   219&lt;BR /&gt;   220      DT_IN_FUNC1("OOSsender::process_sw_clli_det")&lt;BR /&gt;   221&lt;BR /&gt;   222          if ( dt_debug ) {&lt;BR /&gt;   223                  fprintf(stderr,"process_sw_clli_det sw_name =&amp;lt;%s&amp;gt;\n", (const char*)sw_name);&lt;BR /&gt;   224          }&lt;BR /&gt;   225&lt;BR /&gt;   226          // get data from database loaded into tmp_path_n_file&lt;BR /&gt;   227      String path_n_file = this-&amp;gt;GETdirname() + "o" + generateJulianFileName();&lt;BR /&gt;   228      String tmp_path_n_file =  "/tmp/O" + generateJulianFileName();&lt;BR /&gt;   229&lt;BR /&gt;   230      String  buffer;&lt;BR /&gt;   231      String str_outage;&lt;BR /&gt;   232      String str_hrs;&lt;BR /&gt;   233      String str_row;&lt;BR /&gt;   234      String str_gaps;&lt;BR /&gt;   235          Listiter&lt;STRING&gt; hrs_li(this-&amp;gt;det_hrs_list);&lt;BR /&gt;   236          Listiter&lt;STRING&gt; row_li(this-&amp;gt;row_tot_list);&lt;BR /&gt;   237          Listiter&lt;STRING&gt; gap_li(this-&amp;gt;det_gap_list);&lt;BR /&gt;   238          Listiter&lt;STRING&gt; out_li(this-&amp;gt;det_outage_list);&lt;BR /&gt;   239          hrs_li.reset ();&lt;BR /&gt;   240          row_li.reset ();&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;3. Also if there is a variable char *ptr. How do i print the value at the address pointed by ptr and  address contained in the ptr&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/STRING&gt;&lt;/STRING&gt;&lt;/STRING&gt;&lt;/STRING&gt;&lt;/NO&gt;&lt;/NO&gt;&lt;/CLASS&gt;&lt;/CLASS&gt;&lt;/NO&gt;&lt;/NO&gt;&lt;/CLASS&gt;&lt;/CLASS&gt;&lt;/NO&gt;&lt;/NO&gt;&lt;/CLASS&gt;&lt;/CLASS&gt;&lt;/NO&gt;&lt;/NO&gt;&lt;/CLASS&gt;&lt;/CLASS&gt;</description>
      <pubDate>Mon, 09 Oct 2006 12:25:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-char-pointer/m-p/3874438#M773890</guid>
      <dc:creator>vind123</dc:creator>
      <dc:date>2006-10-09T12:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: Regarding char pointer</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regarding-char-pointer/m-p/3874439#M773891</link>
      <description>&lt;!--!*#--&gt;The code below will output the desired value of rc and shows howto...&lt;BR /&gt;&amp;gt;print the value at the address pointed by ptr and address contained in the ptr&amp;lt;&lt;BR /&gt;&lt;BR /&gt;~hope it helps&lt;BR /&gt;&lt;BR /&gt;==============================================================&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;&lt;BR /&gt;int main(void)&lt;BR /&gt;{&lt;BR /&gt;    char *rc;&lt;BR /&gt;    short dt = 1, *pdt = &amp;amp;dt;&lt;BR /&gt;&lt;BR /&gt;    switch (*pdt)&lt;BR /&gt;    {&lt;BR /&gt;        case 1:&lt;BR /&gt;            rc="Intertoll";&lt;BR /&gt;            break;&lt;BR /&gt;        case 2:&lt;BR /&gt;            rc="LocalExchange";&lt;BR /&gt;            break;&lt;BR /&gt;        case 3:&lt;BR /&gt;            rc="other";&lt;BR /&gt;            break;&lt;BR /&gt;    }&lt;BR /&gt;    printf("value at address 0x%lx is %lu\n", pdt, *pdt);&lt;BR /&gt;    printf("%s\n", rc);&lt;BR /&gt;}&lt;/STDIO.H&gt;</description>
      <pubDate>Mon, 09 Oct 2006 17:24:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regarding-char-pointer/m-p/3874439#M773891</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2006-10-09T17:24:16Z</dc:date>
    </item>
  </channel>
</rss>

