-4

i am a complete newbie to C programming language. i am trying to create an if statement with the following code but im not sure how to go about it. I need "producerHelper.SetPrefix("/myprefix1")" to do another command. Any help would be appreciated, thank you.

bool (producerHelper.SetPrefix("/myprefix")) = True;  
if ( True )
{
 producerHelper.SetAttribute("ContentDirectory", StringValue("/home/multimedia_testing/svc720"));
}
else
{
producerHelper.SetAttribute("ContentDirectory", StringValue("/home/multimedia_testing/svc360"));
}
wizzer
  • 7
  • 4
  • 5
    Get yourself a book. – LogicStuff Mar 25 '16 at 11:29
  • 2
    You might want to buy a book and work methodically through that. Asking people on the internet is not such a great way to learn a language like `C++`. **Books:** https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list – Galik Mar 25 '16 at 11:29
  • To be honest im not trying to learn the language, i am from a python background but currently doing a project creating scenarios in ndnSIM, a network simulator,which is c++ based, i am only trying to alter certain aspects of pre written code to suit my scenarios. I have no time to learn another language for the little bit of it i need. – wizzer Mar 25 '16 at 11:35

1 Answers1

1

I suppose what you want is this:

bool res = producerHelper.SetPrefix("/myprefix");  
if ( res )
{
 producerHelper.SetAttribute("ContentDirectory", StringValue("/home/multimedia_testing/svc720"));
}
else
{
producerHelper.SetAttribute("ContentDirectory", StringValue("/home/multimedia_testing/svc360"));
}
marcinj
  • 48,511
  • 9
  • 79
  • 100