Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: having issues using std::string when sending a packet using tcp  (Read 6119 times)

0 Members and 1 Guest are viewing this topic.

dvdw46290

  • Newbie
  • *
  • Posts: 1
    • View Profile
having issues using std::string when sending a packet using tcp
« on: November 26, 2021, 03:08:56 pm »
hi im having issues trying to send a string in a packet.

my code for trying to set up the and send a string is copied of the website however i get an error "Unhandled exception at 0x75F2EA32 in SocketsAndSFML.exe: Microsoft C++ exception: std::length_error at memory location 0x00C0FA50." when is attempts to pack the data into the packet. ie. my code:

sf::Uint16 x = 10;
std::string s = "hello";
double d = 0.6;

sf::Packet packet;
packet << x << s << d; <-------(this is where im getting the error)

thanks for your time and any help would be greatly appreciated


 

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10818
    • View Profile
    • development blog
    • Email
Re: having issues using std::string when sending a packet using tcp
« Reply #1 on: November 26, 2021, 04:41:54 pm »
Are you mixing debug and release libraries?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything