int main() { vector<int>ivec(10); //default initialized to 0 fill(ivec.begin(), ivec.end(), 1); //reset each element to 1 //print elements in ivec auto iter = ivec.begin(); while (iter != ivec.end()) cout << *iter++ << " "; cout << endl; //sum the elements in ivec starting the summation with the value 0 int sum = accumulate(ivec.begin(), ivec.end(), 0); cout << sum << endl; //set a subsequence of the container to 10 fill(ivec.begin(), ivec.begin() + ivec.size() / 2, 10); cout << accumulate(ivec.begin(), ivec.end(), 0) << endl; //reset the same subsequence to 0 fill_n(ivec.begin(), ivec.size() / 2, 0); cout << accumulate(ivec.begin(), ivec.end(), 0) << endl; //concatenates elements in a vector of strings and store in sum vector<string>v; string s; while (cin >> s) v.push_back(s); string concat = accumulate(v.begin(), v.end(), string("")); cout << concat << endl; getchar(); }
int main() { vector<int> vec(10); // default initialized to 0 fill(vec.begin(), vec.end(), 1); // reset each element to 1 // sum the elements in vec starting the summation with the value 0 int sum = accumulate(vec.cbegin(), vec.cend(), 0); cout << sum << endl; // set a subsequence of the container to 10 fill(vec.begin(), vec.begin() + vec.size()/2, 10); cout << accumulate(vec.begin(), vec.end(), 0) << endl; // reset the same subsequence to 0 fill_n(vec.begin(), vec.size()/2, 0); cout << accumulate(vec.begin(), vec.end(), 0) << endl; // create 10 elements on the end of vec each with the value 42 fill_n(back_inserter(vec), 10, 42); cout << accumulate(vec.begin(), vec.end(), 0) << endl; // concatenate elements in a vector of strings and store in sum vector<string> v; string s; while (cin >> s) v.push_back(s); string concat = accumulate(v.cbegin(), v.cend(), string("")); cout << concat << endl; return 0; }
void ZeroCopyDataSeq<Sample_T, DEF_MAX>::length(CORBA::ULong length) { using std::fill; using std::max; using std::copy; if (length == this->length()) { return; } if (is_zero_copy()) { if (length < ptrs_.size()) { if (!loaner_) { make_single_copy(length); this->length(length); return; } for (size_t i(length); i < ptrs_.size(); ++i) { --ptrs_[i]->zero_copy_cnt_; loaner_->dec_ref_data_element(ptrs_[i]); } ptrs_.resize(length, 0); } else { //There's no way we can expand the size (logical) of the zero-copy //array and have the user do any meaningful operations on the new //elements. The fact that they're pointers to ReceivedDataElement //is hidden from the user. Thus we need to make the sequence //single-copy at this point. make_single_copy(length); } } else { if (length < sc_length_) //shrink { sc_length_ = length; } else if (length <= sc_maximum_) //grow within buffer { fill(&sc_buffer_[sc_length_], &sc_buffer_[length], Sample_T()); sc_length_ = length; } else //grow to larger buffer { ZeroCopyDataSeq<Sample_T, DEF_MAX> grow(max(length, sc_maximum_*2)); copy(sc_buffer_, &sc_buffer_[sc_length_], grow.sc_buffer_); fill(&grow.sc_buffer_[sc_length_], &grow.sc_buffer_[length], Sample_T()); swap(grow); } } }
Ksf::Ksf(void) : m_madi( 0 ), m_tick( 0 ), m_dummy( 0 ), m_track( 0 ) { fill( &m_bpm[0], &m_bpm[3], 0.0 ); fill( &m_start[0], &m_start[3], 0 ); fill( &m_bunki[0], &m_bunki[2], 0 ); }
void FillBoundary(unsigned char* image_out, int w, int h, int bpp) { const int line_stride = bpp*w; fill(image_out, image_out+line_stride, 0); for (int y = 1; y < h-1; ++y) { fill(image_out, image_out+bpp, 0); fill(image_out+line_stride-bpp, image_out+line_stride, 0); image_out += line_stride; } fill(image_out, image_out+line_stride, 0); }
bool test(const Problem<Scalar> &p) { BOOST_TEST_MESSAGE("Testing problem " << p); typedef typename suzerain::traits::component<Scalar>::type component_type; using suzerain::complex::traits::is_complex; using std::abs; using std::copy; using std::fill; using std::partial_sum; using std::sqrt; const int N = p.S*p.n; // Allocate working storage suzerain::scoped_array<Scalar> x(new Scalar[N*abs(p.incx)]); suzerain::scoped_array<Scalar> y(new Scalar[N*abs(p.incy)]); suzerain::scoped_array<Scalar> r(new Scalar[N*abs(p.incy)]); // Synthesize test data fill(x.get(), x.get() + N*abs(p.incx), p.alpha+p.alpha+Scalar(1)); if (is_complex<Scalar>::value) { fill(y.get(), y.get() + N*abs(p.incy), p.alpha-Scalar(7) + sqrt(Scalar(-1))); } else { fill(y.get(), y.get() + N*abs(p.incy), p.alpha-Scalar(7)); } partial_sum(x.get(), x.get() + N*abs(p.incx), x.get()); partial_sum(y.get(), y.get() + N*abs(p.incy), y.get()); copy(y.get(), y.get() + N*abs(p.incy), r.get()); // Compute the single-shot result using BSMBSM routines aPxpby(p, x.get(), r.get()); // Compute same result by permuting followed by axpby suzerain::shared_ptr<gsl_permutation> g(suzerain_bsmbsm_permutation(p.S,p.n), &gsl_permutation_free); permute(p, g.get(), x.get()); suzerain::blas::axpby(N, p.alpha, x.get(), p.incx, p.beta, y.get(), p.incy); // Cook a reasonable agreement tolerance component_type tol = std::numeric_limits<component_type>::epsilon(); if (is_complex<Scalar>::value) tol *= 4; // Do r (from aPxpby) and y (from permute/axpby) agree? return check_close_collections(r.get(), r.get() + N*abs(p.incy), y.get(), y.get() + N*abs(p.incy), tol); }
void fill(symmetric_canvas<uint8_t> *grid1,symmetric_canvas<uint8_t> *grid2, double alpha, double exponent, double thickness, double sharpness,stripes_grid &sgr) { auto gen1 = std::bind(random_levy_1d,alpha,1.); function<complex<double>()> gen; if(grid2) gen = [&gen1] () { return complex<double>(gen1(),gen1()); }; else gen = [&gen1] () { return complex<double>(gen1(),0); }; generate(sgr,gen,exponent); fill(sgr,grid1->unsafe_get_canvas(),(stripes_grid::proj_t)std::real,thickness,sharpness); if(grid2) fill(sgr,grid2->unsafe_get_canvas(),(stripes_grid::proj_t)std::imag,thickness,sharpness); }
tap::CodeHeader::CodeHeader (address init, address size, const std::string & filename) { //memset (block, 0, sizeof (block) ); fill (block, block + sizeof (block), byte (0) ); block [0]= 19; // Length of block: 17 bytes + flag + checksum block [1]= 0; block [2]= 0; // Flag: 00 -> header block [3]= 3; // Type: code block. // File name. std::string::size_type l= filename.size (); if (l > 10) l= 10; for (std::string::size_type i= 0; i < 10; ++i) block [4 + i]= i < l ? filename [i] : ' '; // Length of the code block. block [14]= lobyte (size); block [15]= hibyte (size); // Start of the code block. block [16]= lobyte (init); block [17]= hibyte (init); // Parameter 2: 32768 in a code block. block [18]= 0x00; block [19]= 0x80; // Checksum byte check= block [2]; // Flag byte included. for (int i= 3; i < 20; ++i) check^= block [i]; block [20]= check; }
//radius does not include center Kernel::Kernel(int rep,int rad) : repetition(rep), radius(rad), height(2*radius +1) , width (2*radius+1) { k_kernelArray = new float[height*width]; //default is all 0 fill(k_kernelArray, k_kernelArray+height*width, 0.f); factor = 0; }
int main (int argc, char **argv) { // Setting Server's Listen Port ServerPort = SERVERPORT; cout << "Server listening on default port " << SERVERPORT << endl; // Server socket. ServerSocketFD = socket (AF_INET, SOCK_DGRAM, 0); // Server address initialization for binding. ServerAddress.sin_family = AF_INET; // Socekt family. ServerAddress.sin_addr.s_addr = INADDR_ANY; // Setting server IP. INADDR_ANY is the localhost IP. ServerAddress.sin_port = htons (ServerPort); // Setting server port. fill ((char*)&(ServerAddress.sin_zero), (char*)&(ServerAddress.sin_zero)+8, '\0'); // bind() bind (ServerSocketFD, (sockaddr *)&ServerAddress, sizeof (ServerAddress)); // recvfrom() is blocking and will wait for any messages from client. socklen_t ClientAddressSize = sizeof (ClientAddress); NumOfBytesReceived = recvfrom (ServerSocketFD, Buffer, MAXBUFFERSIZE-1, 0, (sockaddr *)&ClientAddress, &ClientAddressSize); Buffer[NumOfBytesReceived] = '\0'; cout << "Server got packet from " << inet_ntoa (ClientAddress.sin_addr) << " on socket " << ServerSocketFD << endl; cout << "Client says: " << Buffer << endl; // sendto() char ServerMessage[] = "Hello from Server. Now bye!"; NumOfBytesSent = sendto (ServerSocketFD, ServerMessage, strlen (ServerMessage), 0, (sockaddr *)&ClientAddress, sizeof (ClientAddress)); // Close connection. close (ServerSocketFD); return 0; }
std::vector<bool>* PrimeSieve(const int64_t& LENGTH) { using std::ceil; using std::fill; using std::sqrt; using std::vector; // Fill with true vector<bool>* primes = new vector<bool>(LENGTH); fill(primes->begin(), primes->end(), true); // 0, 1 are not prime if (LENGTH >= 2) { primes->at(0) = primes->at(1) = false; } else if (LENGTH < 1) { return NULL; } else { primes->at(0) = false; } // Sieve for (int64_t i = 2; i < ceil(sqrt(LENGTH)); ++i) { if (primes->at(i)) { for (int64_t j = i * i; j < LENGTH; j += i) { primes->at(j) = false; } } } return primes; }
treatment::treatment(const real_t& Ma, const pencil_grid& dgrid, bspline& b, inputs& inp, outputs& out) : none(new constraint::disabled(b)) , Ma(Ma) , rank_has_zero_zero_modes(dgrid.has_zero_zero_modes()) , inp(inp) , out(out) , jacobiSvd(0, 0, Eigen::ComputeFullU | Eigen::ComputeFullV) { using std::fill; fill(physical.begin(), physical.end(), none); fill(numerical.begin(), numerical.end(), none); }
INGR_TileHeader::INGR_TileHeader() : ApplicationType(0), SubTypeCode(0), WordsToFollow(0), PacketVersion(0), Identifier(0), Properties(0), DataTypeCode(0), TileSize(0), Reserved3(0) { fill( Reserved, Reserved + CPL_ARRAYSIZE(Reserved), 0 ); fill( Reserved2, Reserved2 + CPL_ARRAYSIZE(Reserved2), 0 ); First.Start = 0; First.Allocated = 0; First.Used = 0; }
static void _invalidate_names(Container& names) { using std::fill; using std::begin; using std::end; fill(begin(names), end(names), _traits::invalid_name()); }
void CoverageMap::resize ( int protLen ) { error = ( protLen == 0 ); if ( !error ) { aaCovered.resize ( protLen ); fill ( aaCovered.begin (), aaCovered.end (), false ); } }
int MSFitSearch::matchFragments ( char* protein, const IntVector& cleavageIndex ) { int numFragments = cleavageIndex.size (); int j, k; if ( mowseScore ) { ProteinMW pmw ( protein ); mowseScore->setMowseArray ( pmw.getMass () ); fill ( mowseMissedCleavages.begin (), mowseMissedCleavages.end (), 0 ); } numScoreMatches = 0; fill ( massMatched.begin (), massMatched.end (), 0 ); DoubleVector& enzymeFragmentMassArray = get_cleaved_masses ( protein, cleavageIndex ); int missedCleavageLimit = missedCleavages; for ( int i = 0 ; i < numFragments ; i++ ) { char* startPep = ( i == 0 ) ? protein : protein + cleavageIndex[i-1] + 1; double fragmentMass = terminal_wt; for ( k = 0, j = i ; j < numFragments ; j++ ) { if ( j > missedCleavageLimit ) break; char* endPep = protein + cleavageIndex[j] + 1; fragmentMass += enzymeFragmentMassArray [j]; if ( cnbr_digest && j == missedCleavageLimit && protein [cleavageIndex [j]] == 'M' ) { fragmentMass += cnbr_homoserine_lactone_mod; } if ( mowseScore ) mowseScore->accumulateMowseScore ( fragmentMass, j == i ); if ( fragmentMass > highMass ) break; if ( fragmentMass > lowMass ) { for ( ; k < numPeaks && fragmentMass > peakMassLowerBound [k] ; k++ ) { if ( !massMatched [k] ) { if ( genAbsDiff ( fragmentMass, peakMass [k] ) < tolerance [k] ) { if ( !compMask || checkComposition ( startPep, endPep - startPep ) ) { numScoreMatches++; massMatched [k] = SCORE_MATCH; if ( mowseScore ) mowseMissedCleavages [k] = j - i; } } } } } } missedCleavageLimit++; } return numScoreMatches; }
int main(int argc, char** argv) { GetPot args(argc, argv); int nthreads = args.follow(1 , "--threads"); int samp = args.follow(100, "--samp"); int reps = args.follow(1 , "--reps"); double shape = args.follow(1.0, "--shape"); double tilt = args.follow(0.0, "--tilt"); fprintf(stderr, "Will draw %i samples %i times using %i threads.\n", samp, reps, nthreads); fprintf(stderr, "Shape: %g; Tilt: %g\n", shape, tilt); vector<double> x(samp); vector<double> h(samp); vector<double> z(samp); fill(h.begin(), h.end(), shape); fill(z.begin(), z.end(), tilt); vector<RNG> r(nthreads); vector<PolyaGamma> dv(nthreads); vector<PolyaGammaAlt> alt(nthreads); vector<PolyaGammaSP> sp(nthreads); struct timeval start, stop; gettimeofday(&start, NULL); for (int i = 0; i < reps; i++) rpg_hybrid_par(&x[0], &h[0], &z[0], &samp, &nthreads, &r, &dv, &alt, &sp); gettimeofday(&stop, NULL); double diff = calculateSeconds(start, stop); fprintf(stderr, "Time: %f sec. for %i samp (%i times)\n", diff, samp, reps); // Check output double m1_hat = accumulate(x.begin(), x.end(), 0.0) / samp; double m2_hat = accumulate(x.begin(), x.end(), 0.0, addsq) / samp; fprintf(stderr, "Sample moments: m1: %g; m2: %g\n", m1_hat, m2_hat); fprintf(stderr, "Actual moments: m1: %g, m2: %g\n", dv[0].pg_m1(shape, tilt), dv[0].pg_m2(shape, tilt)); }
MowseScore::MowseScore ( double mowsePFactor ) : mowsePFactor ( mowsePFactor ) { mowseScore.resize ( NUM_MOWSE_PROTEIN_BINS ); for ( int i = 0 ; i < NUM_MOWSE_PROTEIN_BINS ; i++ ) { mowseScore [i].resize ( NUM_MOWSE_PEPTIDE_BINS ); fill ( mowseScore [i].begin (), mowseScore [i].end (), 0.0 ); } statsNeedUpdating = true; }
int Server::InitialiseAddress(int pPort) // Default Server port is 5000. { ServerPort = pPort; // Server address initialisation for binding. ServerAddress.sin_family = AF_INET; // Socekt family. ServerAddress.sin_addr.s_addr = htonl(INADDR_ANY); // Setting server IP. INADDR_ANY blank IP. ServerAddress.sin_port = htons(ServerPort); // Setting server port. fill((char*)&(ServerAddress.sin_zero), (char*)&(ServerAddress.sin_zero)+8, '\0'); return 0; }
void displayCallback() { glClear(GL_COLOR_BUFFER_BIT); fill(framebuffer.begin(), framebuffer.end(), opaque_black); fill(auxbuffer.begin(), auxbuffer.end(), std::numeric_limits<float>::infinity()); themodel->render(framebuffer, auxbuffer); glDrawPixels(window_width, window_height, GL_RGBA, GL_FLOAT, &(framebuffer[0])); glFlush(); }
void assign(size_t count, const T& value) { if (m_data) delete [] m_data; m_size = count; m_capacity = count; m_data = new T[m_capacity]; fill(m_data, m_data + m_size, value); }
void BackpropagationPerceptron::status_recover() { assert(remembered_W_ != NULL); for (size_t i = 0; i < layers_count_ - 1; i++) { delete (W_[i]); W_[i] = remembered_W_[i]->clone(); for (size_t j = 0; j != prev_direction_W_[i]->rows_count(); j++) { fill((*prev_direction_W_[i])[j], (*prev_direction_W_[i])[j] + prev_direction_W_[i]->columns_count(), 0.0); } } }
void Ksf::_addTick() { double bmpcount = 60.0 / m_bpm[0] * 100.0; StepData_t sd; fill( &sd.step[0], &sd.step[13], '0' ); // sd.step = "0000000000000"; for( double tmpStart = m_start[0] ; bmpcount < tmpStart ; tmpStart -= bmpcount ) { for( int i = 0 ; i < m_tick ; ++ i ) { m_step.push_back( sd ); } } }
EmbeddingResult triangulate(RandomAccessIterator begin, RandomAccessIterator end, PairwiseCallback distance_callback, const Landmarks& landmarks, const DenseVector& landmark_distances_squared, EmbeddingResult& landmarks_embedding, unsigned int target_dimension) { timed_context context("Landmark triangulation"); bool* to_process = new bool[end-begin]; fill(to_process,to_process+(end-begin),true); DenseMatrix embedding((end-begin),target_dimension); for (Landmarks::const_iterator iter=landmarks.begin(); iter!=landmarks.end(); ++iter) { to_process[*iter] = false; embedding.row(*iter).noalias() = landmarks_embedding.first.row(iter-landmarks.begin()); } for (unsigned int i=0; i<target_dimension; ++i) landmarks_embedding.first.col(i).array() /= landmarks_embedding.second(i); // landmarks_embedding.first.transposeInPlace(); RandomAccessIterator iter; DenseVector distances_to_landmarks; //#pragma omp parallel private(distances_to_landmarks) { distances_to_landmarks = DenseVector(landmarks.size()); //#pragma omp for private(iter) schedule(static) for (iter=begin; iter<end; ++iter) { if (!to_process[iter-begin]) continue; for (unsigned int i=0; i<distances_to_landmarks.size(); ++i) { DefaultScalarType d = distance_callback(*iter,begin[landmarks[i]]); distances_to_landmarks(i) = d*d; } //distances_to_landmarks.array().square(); distances_to_landmarks -= landmark_distances_squared; embedding.row(iter-begin).noalias() = -0.5*landmarks_embedding.first.transpose()*distances_to_landmarks; } } delete[] to_process; return EmbeddingResult(embedding,DenseVector()); }
void CoverageMap::setCoverage ( const int start, const int end, const unsigned char val ) { if ( !error ) { int len = aaCovered.size (); if ( start > len || end > len ) { string err ( "A problem has been encountered setting a coverage map.\n Start AA = " ); err += gen_itoa ( start ); err += ". End AA = "; err += gen_itoa ( end ); err += ". Protein Length = "; err += gen_itoa ( len ); err += ".\n"; throw runtime_error ( err ); } else fill ( aaCovered.begin () + start - 1, aaCovered.begin () + end, val ); } }
int main (int argc, char **argv) { // Setting Server's Listen Port ServerPort = SERVERPORT; cout << "Server listening on default port " << SERVERPORT << endl; // Server socket. ServerSocketFD = socket (AF_INET, SOCK_STREAM, 0); // Set socket options. SO_REUSEADDR will prevent "socket in use" errors if server is shutdown. setsockopt (ServerSocketFD, SOL_SOCKET, SO_REUSEADDR, &Yes, sizeof (int)); // Server address initialization for binding. ServerAddress.sin_family = AF_INET; // Socekt family. ServerAddress.sin_addr.s_addr = INADDR_ANY; // Setting server IP. INADDR_ANY is the localhost IP. ServerAddress.sin_port = htons (ServerPort); // Setting server port. fill ((char*)&(ServerAddress.sin_zero), (char*)&(ServerAddress.sin_zero)+8, '\0'); // bind() bind (ServerSocketFD, (sockaddr *)&ServerAddress, sizeof (ServerAddress)); // listen() listen (ServerSocketFD, 0); // Accept will block and wait for connections to accept. sin_size = sizeof (ClientAddress); ClientSocketFD = accept (ServerSocketFD, (sockaddr *)&ClientAddress, &sin_size); // Blocking. cout << "*** Server got connection from " << inet_ntoa (ClientAddress.sin_addr) << " on socket '" << ClientSocketFD << "' ***" << endl; // recv() is blocking and will wait for any messages from client. NumOfBytesReceived = recv (ClientSocketFD, Buffer, MAXBUFFERSIZE-1, 0); // Blocking. Buffer[NumOfBytesReceived] = '\0'; cout << "Client says: " << Buffer << endl; // send() char ServerMessage[] = "Hello from Server. Now bye!"; NumOfBytesSent = send (ClientSocketFD, ServerMessage, strlen (ServerMessage), 0); // Close connection. close (ClientSocketFD); close (ServerSocketFD); return 0; }
GraphicsSystem::GraphicsObjectSettings::GraphicsObjectSettings( Gameexe& gameexe) { if (gameexe.exists("OBJECT_MAX")) objects_in_a_layer = gameexe("OBJECT_MAX"); else objects_in_a_layer = 256; // First we populate everything with the special value position.reset(new unsigned char[objects_in_a_layer]); fill(position.get(), position.get() + objects_in_a_layer, 0); if (gameexe.exists("OBJECT.999")) data.push_back(ObjectSettings(gameexe("OBJECT.999"))); else data.push_back(ObjectSettings()); // Read the #OBJECT.xxx entries from the Gameexe GameexeFilteringIterator it = gameexe.filtering_begin("OBJECT."); GameexeFilteringIterator end = gameexe.filtering_end(); for (; it != end; ++it) { string s = it->key().substr(it->key().find_first_of(".") + 1); std::list<int> object_nums; string::size_type poscolon = s.find_first_of(":"); if ( poscolon != string::npos ) { int obj_num_first = lexical_cast<int>(s.substr(0, poscolon)); int obj_num_last = lexical_cast<int>(s.substr(poscolon + 1)); while ( obj_num_first <= obj_num_last ) { object_nums.push_back(obj_num_first++); } } else { object_nums.push_back(lexical_cast<int>(s)); } for ( std::list<int>::const_iterator intit = object_nums.begin(); intit != object_nums.end(); ++intit ) { int obj_num = *intit; if (obj_num != 999 && obj_num < objects_in_a_layer) { position[obj_num] = data.size(); data.push_back(ObjectSettings(*it)); } } } }
// genearate listSize random numbers and output to stdout void generate_random (int listSize) { vector<int> numbers(MAX_NUMBER); int ri; int null_field = MIN_NUMBER - 1; fill(numbers.begin(), numbers.end(), null_field); for (int i=0; i < listSize; i++) { do { ri = random_int(); } while (numbers[ri] != null_field); unsorted_list << ri << endl; numbers[ri] = ri; } for (vector<int>::iterator i=numbers.begin(); i != numbers.end(); ++i) if ((*i) != null_field) sorted_list << (*i) << endl; }
vector<symmetric_canvas<uint8_t>> paint_squiggles(size_t ncolors, size_t size, symgroup sg, double alpha, double exponent, double thickness, double sharpness) { vector<symmetric_canvas<uint8_t>> grids(ncolors); vector<stripes_grid> stripes_grids; for(size_t i=0;i<ncolors;i+=2) stripes_grids.emplace_back(size,sg); # pragma omp parallel for for(size_t i=0;i<stripes_grids.size();i++) { symmetric_canvas<uint8_t> *grid1=&(grids[2*i]), *grid2; (*grid1)=symmetric_canvas<uint8_t>(size,sg); if(2*i+1<ncolors) { grid2=&(grids[2*i+1]); (*grid2)=symmetric_canvas<uint8_t>(size,sg); } else grid2=nullptr; fill(grid1,grid2,alpha,exponent,thickness,sharpness,stripes_grids[i]); } return grids; }
int Server::SendTo(void* Data, int DataSize, char* pTheirIP, int pTheirPort) { struct hostent* TheirIP; // Server name/IP. if ((TheirIP = gethostbyname(pTheirIP)) == NULL) { cerr << "ERROR009: Getting Their name/IP" << endl; return -1; } // Initializing Their address to send to. TheirAddress.sin_family = AF_INET; // Socket family. TheirAddress.sin_addr = *((in_addr*)(*TheirIP).h_addr); // Their name/IP. TheirAddress.sin_port = htons(pTheirPort); // Their port provided as argument. fill((char*)&(TheirAddress.sin_zero), (char*)&(TheirAddress.sin_zero)+8, '\0'); errorcheck = NumOfBytesSent = sendto(ServerSocketFD, (char*)Data, DataSize, 0, (sockaddr*)&TheirAddress, sizeof(TheirAddress)); if (errorcheck == -1) { cerr << "ERROR010: Server Sending to. " << endl; } return errorcheck; }