src/netanim/model/animation-interface.cc
changeset 9063 32755d0516f4
parent 9012 e1353799d7c6
child 9064 21326214dcd5
equal deleted inserted replaced
9062:d14e2430213d 9063:32755d0516f4
    38 #include "ns3/lte-enb-phy.h"
    38 #include "ns3/lte-enb-phy.h"
    39 #include "ns3/uan-net-device.h"
    39 #include "ns3/uan-net-device.h"
    40 #include "ns3/uan-mac.h"
    40 #include "ns3/uan-mac.h"
    41 #include "ns3/ipv4.h"
    41 #include "ns3/ipv4.h"
    42 
    42 
    43 #include <stdio.h>
    43 #include <cstdio>
    44 #include <unistd.h>
    44 #include <unistd.h>
    45 #include <sstream>
    45 #include <sstream>
    46 #include <fstream>
    46 #include <fstream>
    47 #include <string>
    47 #include <string>
    48 #include <iomanip>
    48 #include <iomanip>
   123   if (m_outputFileSet)
   123   if (m_outputFileSet)
   124     {
   124     {
   125       return true;
   125       return true;
   126     }
   126     }
   127   NS_LOG_INFO ("Creating new trace file:" << fn.c_str ());
   127   NS_LOG_INFO ("Creating new trace file:" << fn.c_str ());
   128   m_f = fopen (fn.c_str (), "w");
   128   m_f = std::fopen (fn.c_str (), "w");
   129   if (!m_f)
   129   if (!m_f)
   130     {
   130     {
   131       NS_FATAL_ERROR ("Unable to open Animation output file");
   131       NS_FATAL_ERROR ("Unable to open Animation output file");
   132       return false; // Can't open
   132       return false; // Can't open
   133     }
   133     }
   605     {
   605     {
   606       if (m_xml)
   606       if (m_xml)
   607         { // Terminate the anim element
   607         { // Terminate the anim element
   608           WriteN (GetXMLClose ("anim"));
   608           WriteN (GetXMLClose ("anim"));
   609         }
   609         }
   610           fclose (m_f);
   610       std::fclose (m_f);
   611     }
   611     }
   612     m_outputFileSet = false;
   612     m_outputFileSet = false;
   613 }
   613 }
   614 
   614 
   615 int AnimationInterface::WriteN (const std::string& st)
   615 int AnimationInterface::WriteN (const std::string& st)
   690   uint32_t    nLeft   = count;
   690   uint32_t    nLeft   = count;
   691   const char* p       = data;
   691   const char* p       = data;
   692   uint32_t    written = 0;
   692   uint32_t    written = 0;
   693   while (nLeft)
   693   while (nLeft)
   694     {
   694     {
   695       int n = fwrite (p, 1,  nLeft, m_f);
   695       int n = std::fwrite (p, 1,  nLeft, m_f);
   696       if (n <= 0) 
   696       if (n <= 0) 
   697         {
   697         {
   698           return written;
   698           return written;
   699         }
   699         }
   700       written += n;
   700       written += n;