473,549 Members | 3,109 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Convert String in file

Is it possible to convert a string in a file. The problem is this:
I have an object string that is a file xml and I want to pass to Deserialize
function, but Deserialize function expect an object of FileStream type and
the mode access.
There is a function Convert.ChangeT ype(object value, Type conversionType) ,
but I cant write for example:
Convert.ChangeT ype(mystring, FileStream);
CAN YOU HELP ME????? thanks
Mar 23 '06 #1
3 7970
Hi,

Are you sure that you need a FileStream instnace and not a Stream one?

If you can use a Stream instance what you can do is decorate the string as a
MemoryStream and pass it to the Deserialize method
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Ursula" <Ur****@discuss ions.microsoft. com> wrote in message
news:FF******** *************** ***********@mic rosoft.com...
Is it possible to convert a string in a file. The problem is this:
I have an object string that is a file xml and I want to pass to
Deserialize
function, but Deserialize function expect an object of FileStream type
and
the mode access.
There is a function Convert.ChangeT ype(object value, Type conversionType) ,
but I cant write for example:
Convert.ChangeT ype(mystring, FileStream);
CAN YOU HELP ME????? thanks

Mar 23 '06 #2
Is a possible solution!But how I can do this?
How I can convert string in a Stream type?

"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,

Are you sure that you need a FileStream instnace and not a Stream one?

If you can use a Stream instance what you can do is decorate the string as a
MemoryStream and pass it to the Deserialize method
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Ursula" <Ur****@discuss ions.microsoft. com> wrote in message
news:FF******** *************** ***********@mic rosoft.com...
Is it possible to convert a string in a file. The problem is this:
I have an object string that is a file xml and I want to pass to
Deserialize
function, but Deserialize function expect an object of FileStream type
and
the mode access.
There is a function Convert.ChangeT ype(object value, Type conversionType) ,
but I cant write for example:
Convert.ChangeT ype(mystring, FileStream);
CAN YOU HELP ME????? thanks


Mar 23 '06 #3
Hi,
"Ursula" <Ur****@discuss ions.microsoft. com> wrote in message
news:8B******** *************** ***********@mic rosoft.com...
Is a possible solution!But how I can do this?
How I can convert string in a Stream type?


You do not convert it, you just initialize a new MemoryStream with the
content of the string

Take a look at the constructor.

From memory I think this is the way to go:

new MemoryStream( Encoding.ASCII. GetBytes( your_string) );

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
Mar 23 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
7209
by: mevar81 | last post by:
Hello to everybody.I have a problem.I used a TypeDescriptor to retrieve a TypeConverter to convert an Image to a string.The problem is that it converts the image to the string "System.Drawing.Bitmap" so lately I can't convert the string to an Image.I've tryed to use an ImageConverter too,but the result is the same. Why the converter works...
2
12164
by: Mel WEaver | last post by:
Hello, I have the following delphi structure for a binary file. I'm looking for idea how to read this file. Mel type TMenuDataStruct = packed record exename : string;
4
3277
by: dale zhang | last post by:
Hi, I am trying to save and read an image from MS Access DB based on the following article: http://www.vbdotnetheaven.com/Code/Sept2003/2175.asp Right now, I saved images without any errors. After reading the ole object from db, I saved it to C: as file1.bmp and displayed on the web. But it can not be displayed. After I manually sent...
12
2955
by: Brian Henry | last post by:
first question... I have a flat file which unfortinuatly has columns seperated by nulls instead of spaces (a higher up company created it this way for us) is there anyway to do a readline with this and not have it affected by the null? because it is right now causes truncated data at wierd places... but as soon as i manually with a hex editor...
5
3772
by: Learner | last post by:
Hello, Here is the code snippet I got strucked at. I am unable to convert the below line of code to its equavalent vb.net code. could some one please help me with this? static public List<RoleData> GetRoles() { return GetRoles(null, false); }
3
13705
by: GM | last post by:
Dear all, Could you all give me some guide on how to convert my big5 string to unicode using python? I already knew that I might use cjkcodecs or python 2.4 but I still don't have idea on what exactly I should do. Please give me some sample code if you could. Thanks a lot Regards, Gary
7
19201
by: elliotng.ee | last post by:
I have a text file that contains a header 32-bit binary. For example, the text file could be: %%This is the input text %%test.txt Date: Tue Dec 26 14:03:35 2006 00000000000000001111111111111111 11111111111111111111111111111111 00000000000000000000000000000000 11111111111111110000000000000000
5
3561
by: Dave Bootsma | last post by:
I have an application where I want to redraw a polygon from points I retrieve from a file. The file is read with streamreader line by line each line contains the points for each polygon. Below is a typical line from my file. 500,748 500,678 552,678 552,696 584,696 584,714 612,714 612,748 Each set of x,y coordinates is separated by a space....
19
5316
by: est | last post by:
From python manual str( ) Return a string containing a nicely printable representation of an object. For strings, this returns the string itself. The difference with repr(object) is that str(object) does not always attempt to return a string that is acceptable to eval(); its goal is to return a printable string. If no argument is given,...
0
10724
Debadatta Mishra
by: Debadatta Mishra | last post by:
Introduction In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information inside an image, hide your complete image as text ,search for a particular image inside a directory, minimize the size of the image. However this is not...
0
7446
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7956
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7470
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5088
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3498
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1936
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1058
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
763
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.