Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Two functions into one
Message
From
27/06/2006 12:22:07
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
27/06/2006 12:12:33
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01131998
Message ID:
01132076
Views:
15
>>But for a jpg you shouldn't do a conversion. IOW remove conversion from code. Just write it out with BinaryWriter (might do with text as well).
>>PS:UnicodeEncoding was sample and you might use other encodings' GetString() method too. Unicode is 2 bytes per character.
>
>Well, the goal of FileToStr() is to have a universal function that can send me the string equivalent of all kind of files. So, basically, if I do FileToStr("d:\Text.txt") or FileToStr("d:\Logo.jpg"), I need to have the string equivalent. This is why I ended up with FileToStr() and FileToStrBinary() in my framework.
>
>As for VFP's FileToStr(), I read on West Wind board that this function cannot handle binary files and someone else over there ended up in the same situation as me, but from VFP that time. IAC, I did two methods to achieve the same. So, it seems VFP's FileToStr(), based from what I read, cannot accomplish that from one function as it can only work with text files.
>
>However, if you can know how to accomplish a .NET FileToStr() method that would handle all kind of files, that would be appreciated.

Michel,
I don't have a ready one (there is I know but where:), I'll find or write one later.
As per VFP's FileToStr() information is not correct as I read it. It can handle binary files perfectly well (under the covers just does binary reading, not text).
The problem with .Net you're trying to send back a string. A string is not compatible with binary data as I observed and I might be wrong (to say in other terms -if I can:)- serializing a binary data just as string without any encoding like base64 would lead to corruption).
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform