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 » Community » Coffee corner » Portability of serialized files on Linux(UBUNTU) and Windows
Portability of serialized files on Linux(UBUNTU) and Windows [message #42800] Fri, 04 April 2014 23:01 Go to next message
ManfredHerr is currently offline  ManfredHerr
Messages: 67
Registered: February 2013
Location: Germany
Member
Hi,

if you serialize a structure that contains multiline text in Linux and try to read it in Windows then you get an error (and vice versa). I think this is because of the additional carriage return of text lines in Windows.

This CR you have to take care of as well when reading text files in a string and split it into lines.

The question is: Is it more important to be compatible to windows text or to be portable?

I think there should be an option to strip this CR. Isn't it?

Perhaps, there is already one and I missed it? Rolling Eyes
Re: Portability of serialized files on Linux(UBUNTU) and Windows [message #42802 is a reply to message #42800] Sat, 05 April 2014 04:42 Go to previous messageGo to next message
nlneilson is currently offline  nlneilson
Messages: 644
Registered: January 2010
Location: U.S. California. Mojave &...
Contributor
Setup->Environment->Editor->Line ending->Detect with default CRLF

I don't really understand what your problem actually is.
I have been using Win XP, 7 and Ubuntu for several years without any problem.

Could you clarify and a runnable example.
Win will work with just LF or \n without the CR (unless I am wrong).

When I parse a text string a character at a time:
0D = 13, 0A = 10
        int ic = 0;
        char ch;
    	for ( int i = 0; i < cc; i++ ){
    	    ic = (ln[i]);
            ch = ic;
	    if (ic==10) continue;
---

This is just a quick guess.
if (ic==10) continue; // this just drops the 0A

[Updated on: Sat, 05 April 2014 07:03]

Report message to a moderator

Re: Portability of serialized files on Linux(UBUNTU) and Windows [message #42803 is a reply to message #42800] Sat, 05 April 2014 08:39 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13053
Registered: November 2005
Ultimate Member
I actually doubt that the issue is caused by multiline text but it Čan ve something else. Definitely worth investigating bu i would welcome a testcase...
Re: Portability of serialized files on Linux(UBUNTU) and Windows [message #42826 is a reply to message #42803] Sun, 06 April 2014 18:11 Go to previous message
ManfredHerr is currently offline  ManfredHerr
Messages: 67
Registered: February 2013
Location: Germany
Member
Embarassed I have to apologize! It seems that I tricked myself and copied some older files from UBUNTU to WINDOWS. Probably, they would have given an error on UBUNTU as well. Latest files work on both environments.

But an other point I noticed:
C:\upp\uppsrc\Core\Util.cpp(966) : error C2666: 'Upp::Vector<T>::operator []' : 4 overloads have similar conversions
        with
        [
            T=Upp::String
        ]
        c:\upp\uppsrc\core\Vcont.h(49): could be 'Upp::String &Upp::Vector<T>::operator [](int)'
        with
        [
            T=Upp::String
        ]
        c:\upp\uppsrc\core\Vcont.h(48): or 'const Upp::String &Upp::Vector<T>::operator [](int) const'
        with
        [
            T=Upp::String
        ]
        or 'built-in C++ operator[(Upp::String *, Upp::dword)'
        or 'built-in C++ operator[(const Upp::String *, Upp::dword)'
        while trying to match the argument list '(Upp::Vector<T>, Upp::dword)'
        with
        [
            T=Upp::String
        ]

This error message I get with MSC8. MSC10 compiles without Problems. But MSC8 is default when installing TheIDE from new.
Previous Topic: Optimizing svo_memeq -- just for curiosity
Next Topic: key software locker
Goto Forum:
  


Current Time: Tue Jan 26 22:06:51 CET 2021

Total time taken to generate the page: 0.01462 seconds