Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » Crash on LoadFromFile
Crash on LoadFromFile [message #11914] Mon, 01 October 2007 03:54 Go to previous message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

Proceeding with U++ usage led me to another strange moment, which I couldn`t solve with docs&forum search.
Loading config in a closest to examples manner, crashes application with assert in debug mode:

index.php?t=getfile&id=757&private=0



May be I`m doing something wrong, but I don`t see any difference between my code and docs-how-it`s-done-right:
#define CONFIG_FILE "config."

struct Config
{
	wxBaud   baud;
	wxParity parity;
	int      com;
	int      wordlen;
	int      stopbits;
	int      addr;
	
	void Serialize(Stream& s)
	{
		s.Put(&baud, sizeof(baud));
		s.Put(&parity, sizeof(parity));
		s % com % wordlen % stopbits % addr;
	}
};
Config config; 

void Kran::LoadAndInit()
{
	if (!LoadFromFile(config, ConfigFile(CONFIG_FILE)))
	{
		config.baud     = wxBAUD_38400;
		config.com      = 1;
		config.parity   = wxPARITY_NONE;
		config.wordlen  = 8;
		config.stopbits = 1;
		config.addr     = 1;
	}

This code causes assertion in LoadFromFile.

Could you please help with this?
  • Attachment: upp2.jpg
    (Size: 20.21KB, Downloaded 653 times)

[Updated on: Mon, 01 October 2007 03:56]

Report message to a moderator

 
Read Message
Read Message
Read Message
Previous Topic: Transfer Semantics - Initializer list and copy constructors
Next Topic: is there a function to stop the program N milliseconds?
Goto Forum:
  


Current Time: Sat Jul 05 08:42:44 CEST 2025

Total time taken to generate the page: 0.02832 seconds