<?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: Using system Function call in HP UNIX in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/using-system-function-call-in-hp-unix/m-p/4148513#M90738</link>
    <description>"Yes i know these are variables"&lt;BR /&gt;&lt;BR /&gt;Really? But you don't handle them as variables.&lt;BR /&gt;&lt;BR /&gt;man system:&lt;BR /&gt;&lt;BR /&gt;SYNOPSIS&lt;BR /&gt;      #include &lt;STDLIB.H&gt;&lt;BR /&gt;&lt;BR /&gt;      int system(const char *command);&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;You need to *build* the command string first!&lt;/STDLIB.H&gt;</description>
    <pubDate>Thu, 21 Feb 2008 15:13:06 GMT</pubDate>
    <dc:creator>Torsten.</dc:creator>
    <dc:date>2008-02-21T15:13:06Z</dc:date>
    <item>
      <title>Using system Function call in HP UNIX</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-system-function-call-in-hp-unix/m-p/4148505#M90730</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;   I want to rename a file in a C++ Program.&lt;BR /&gt;   So i am using the system function call as follows .&lt;BR /&gt;&lt;BR /&gt;   int amin()&lt;BR /&gt;    {&lt;BR /&gt;      string src="Test.txt";&lt;BR /&gt;      string Dest = "Test_1.txt"&lt;BR /&gt;      system("mv Src Dest"); &lt;BR /&gt;      }  &lt;BR /&gt;    But if i execute the program the error message saying Src no such file or directory is displayed.&lt;BR /&gt;   &lt;BR /&gt;    I also tried to do this by calling a shell script in the system function call as follows &lt;BR /&gt;  int amin()&lt;BR /&gt;    {&lt;BR /&gt;      string src="Test.txt";&lt;BR /&gt;      string Dest = "Test_1.txt"&lt;BR /&gt;      system("./Move.sh Src Dest"); &lt;BR /&gt;      }  &lt;BR /&gt;&lt;BR /&gt;      Move.sh is as follows&lt;BR /&gt;      mv $1 $2&lt;BR /&gt;&lt;BR /&gt;        But, again the same error.&lt;BR /&gt;&lt;BR /&gt;    Can some one help me to achive this.&lt;BR /&gt;&lt;BR /&gt;thanks in advance &lt;BR /&gt;Vikram</description>
      <pubDate>Thu, 21 Feb 2008 14:07:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-system-function-call-in-hp-unix/m-p/4148505#M90730</guid>
      <dc:creator>CA1490051</dc:creator>
      <dc:date>2008-02-21T14:07:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using system Function call in HP UNIX</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-system-function-call-in-hp-unix/m-p/4148506#M90731</link>
      <description>Your system is trying to do exactly what you wrote:&lt;BR /&gt;&lt;BR /&gt;system("mv Src Dest"); &lt;BR /&gt;&lt;BR /&gt;# mv Src Dest&lt;BR /&gt;&lt;BR /&gt;Do you have a file called "Src"?&lt;BR /&gt;No? Precisely.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 21 Feb 2008 14:15:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-system-function-call-in-hp-unix/m-p/4148506#M90731</guid>
      <dc:creator>Torsten.</dc:creator>
      <dc:date>2008-02-21T14:15:52Z</dc:date>
    </item>
    <item>
      <title>Re: Using system Function call in HP UNIX</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-system-function-call-in-hp-unix/m-p/4148507#M90732</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Does your environment's PATH reflect where your files reside?&lt;BR /&gt;&lt;BR /&gt;For that matter, why write a C or C++ program only to call 'system()' to rename a file?  You should call 'rename()' [assuming that the source and destination reside within the same filesystem].&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 21 Feb 2008 14:29:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-system-function-call-in-hp-unix/m-p/4148507#M90732</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-02-21T14:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: Using system Function call in HP UNIX</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-system-function-call-in-hp-unix/m-p/4148508#M90733</link>
      <description>Dear Vikram,&lt;BR /&gt;&lt;BR /&gt;STOP!&lt;BR /&gt;&lt;BR /&gt;Take your fingers from the keyboard and slowly turn around. &lt;BR /&gt;Walk to the nearest bookshelf and pick up a basic programmign book. &lt;BR /&gt;Any language. &lt;BR /&gt;even K&amp;amp;R C would be a good start. &lt;BR /&gt;Focus on VARIABLES. &lt;BR /&gt;Spend a few quality hours with the books. Now turn back.&lt;BR /&gt;&lt;BR /&gt;But don't touch that compiler just yet.&lt;BR /&gt;Look around some first, notably with the 'man' pages.&lt;BR /&gt;&lt;BR /&gt;Specifically type, and read, &lt;BR /&gt;man rename&lt;BR /&gt;man sprintf&lt;BR /&gt;&lt;BR /&gt;Welcome to the wonderous world of programming!&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 21 Feb 2008 14:33:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-system-function-call-in-hp-unix/m-p/4148508#M90733</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2008-02-21T14:33:18Z</dc:date>
    </item>
    <item>
      <title>Re: Using system Function call in HP UNIX</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-system-function-call-in-hp-unix/m-p/4148509#M90734</link>
      <description>&lt;!--!*#--&gt;...&lt;BR /&gt;if ( rename(Src, Dest) == 0 )&lt;BR /&gt;      printf("%s renamed to %s\n", Src, Dest);&lt;BR /&gt;    else&lt;BR /&gt;      perror("rename");&lt;BR /&gt;&lt;BR /&gt;    return 0;&lt;BR /&gt;...</description>
      <pubDate>Thu, 21 Feb 2008 14:37:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-system-function-call-in-hp-unix/m-p/4148509#M90734</guid>
      <dc:creator>Torsten.</dc:creator>
      <dc:date>2008-02-21T14:37:34Z</dc:date>
    </item>
    <item>
      <title>Re: Using system Function call in HP UNIX</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-system-function-call-in-hp-unix/m-p/4148510#M90735</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;   I can rename the file using rename(). But, now i want it to tar and zip it.&lt;BR /&gt;&lt;BR /&gt;    Can any one tell me how to achive this?&lt;BR /&gt;&lt;BR /&gt;    system("tar -cvf file.tar file");&lt;BR /&gt;&lt;BR /&gt;     Obviously the shell will complain that file not found. &lt;BR /&gt;      Where file for me is a string variable &lt;BR /&gt;initialised to "Temp.txt";&lt;BR /&gt;&lt;BR /&gt;thaks and regards&lt;BR /&gt;Vikram</description>
      <pubDate>Thu, 21 Feb 2008 14:57:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-system-function-call-in-hp-unix/m-p/4148510#M90735</guid>
      <dc:creator>CA1490051</dc:creator>
      <dc:date>2008-02-21T14:57:04Z</dc:date>
    </item>
    <item>
      <title>Re: Using system Function call in HP UNIX</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-system-function-call-in-hp-unix/m-p/4148511#M90736</link>
      <description>As mentioned above (directly and indirectly) - learn to work with variables!&lt;BR /&gt;&lt;BR /&gt;From your initial question:&lt;BR /&gt;&lt;BR /&gt;system("mv Src Dest"); &lt;BR /&gt;&lt;BR /&gt;Src and Dest are **NAMES** - not variables from the system point of view!</description>
      <pubDate>Thu, 21 Feb 2008 15:04:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-system-function-call-in-hp-unix/m-p/4148511#M90736</guid>
      <dc:creator>Torsten.</dc:creator>
      <dc:date>2008-02-21T15:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: Using system Function call in HP UNIX</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-system-function-call-in-hp-unix/m-p/4148512#M90737</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;       Yes i know these are variables. But, still there is a requirement that i should achive this. &lt;BR /&gt;&lt;BR /&gt;       Any way to do this will be great help for us.....&lt;BR /&gt;&lt;BR /&gt;    thanks and regards&lt;BR /&gt;Vikram&lt;BR /&gt;</description>
      <pubDate>Thu, 21 Feb 2008 15:08:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-system-function-call-in-hp-unix/m-p/4148512#M90737</guid>
      <dc:creator>CA1490051</dc:creator>
      <dc:date>2008-02-21T15:08:21Z</dc:date>
    </item>
    <item>
      <title>Re: Using system Function call in HP UNIX</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-system-function-call-in-hp-unix/m-p/4148513#M90738</link>
      <description>"Yes i know these are variables"&lt;BR /&gt;&lt;BR /&gt;Really? But you don't handle them as variables.&lt;BR /&gt;&lt;BR /&gt;man system:&lt;BR /&gt;&lt;BR /&gt;SYNOPSIS&lt;BR /&gt;      #include &lt;STDLIB.H&gt;&lt;BR /&gt;&lt;BR /&gt;      int system(const char *command);&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;You need to *build* the command string first!&lt;/STDLIB.H&gt;</description>
      <pubDate>Thu, 21 Feb 2008 15:13:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-system-function-call-in-hp-unix/m-p/4148513#M90738</guid>
      <dc:creator>Torsten.</dc:creator>
      <dc:date>2008-02-21T15:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: Using system Function call in HP UNIX</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-system-function-call-in-hp-unix/m-p/4148514#M90739</link>
      <description>Hi (again) Vikram:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Yes i know these are variables. But, still there is a requirement that i should achive this. &lt;BR /&gt;&lt;BR /&gt;This seems like a purely academic exercise.  I agree with both Hein and Torsten's comments which are meant to be helpful.  The use of 'system()' to perform shell tasks in a C program says that you may need to rethink your objective and your use of tools.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 21 Feb 2008 15:27:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-system-function-call-in-hp-unix/m-p/4148514#M90739</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2008-02-21T15:27:00Z</dc:date>
    </item>
    <item>
      <title>Re: Using system Function call in HP UNIX</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-system-function-call-in-hp-unix/m-p/4148515#M90740</link>
      <description>int main()&lt;BR /&gt;{&lt;BR /&gt;char *src="Test.txt";&lt;BR /&gt;char * Dest = "Test_1.txt"&lt;BR /&gt;char commande[256];&lt;BR /&gt;&lt;BR /&gt;sprintf(commande,"/usr/bin/mv %s %s",Src,Dest);&lt;BR /&gt;system(commande);&lt;BR /&gt;} &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 21 Feb 2008 16:43:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-system-function-call-in-hp-unix/m-p/4148515#M90740</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2008-02-21T16:43:14Z</dc:date>
    </item>
    <item>
      <title>Re: Using system Function call in HP UNIX</title>
      <link>https://community.hpe.com/t5/operating-system-linux/using-system-function-call-in-hp-unix/m-p/4148516#M90741</link>
      <description>Hi Laurent,&lt;BR /&gt;&lt;BR /&gt;     Thank you very much for the solution&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;regards&lt;BR /&gt;Vikram</description>
      <pubDate>Fri, 14 Mar 2008 07:03:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/using-system-function-call-in-hp-unix/m-p/4148516#M90741</guid>
      <dc:creator>CA1490051</dc:creator>
      <dc:date>2008-03-14T07:03:54Z</dc:date>
    </item>
  </channel>
</rss>

