Re: [PHP] String to Stream

2005-08-05 Thread Jochem Maas
Eric Gorr wrote: Jochem Maas wrote: Eric Gorr wrote: Jochem Maas wrote: > http://php.net/manual/en/function.stream-wrapper-register.php is as close as it gets I think. - total overkill for manipulating strings IMHO - (me thinks there is atleast one other in agreement) - there is a reason

RE: [PHP] String to Stream

2005-08-05 Thread Jay Blanchard
[snip] Well, as I mentioned before, you are welcome to look into the surrounding useful examples for istringstream, etc. I can't think of a single reason why similar reasons why istringstream, etc. is useful would not apply to a php stream_wrapper for strings. As for why things like istringstre

Re: [PHP] String to Stream

2005-08-05 Thread Eric Gorr
Jochem Maas wrote: Eric Gorr wrote: Jochem Maas wrote: > http://php.net/manual/en/function.stream-wrapper-register.php is as close as it gets I think. - total overkill for manipulating strings IMHO - (me thinks there is atleast one other in agreement) - there is a reason php has all those b

Re: [PHP] String to Stream

2005-08-05 Thread Jochem Maas
Eric Gorr wrote: Jochem Maas wrote: > http://php.net/manual/en/function.stream-wrapper-register.php is as close as it gets I think. - total overkill for manipulating strings IMHO - (me thinks there is atleast one other in agreement) - there is a reason php has all those built in string funct

Re: [PHP] String to Stream

2005-08-05 Thread Miles Thompson
But WHY WHY WHY would one want to treat a string as a stream, when PHP has such good string handling functions? THATS not been explained. (Unless, knowing C and its limited string handling capabilities, one is looking for a familiar hammer.) It's Friday - time to go socialize - Miles PS H

Re: [PHP] String to Stream

2005-08-05 Thread Eric Gorr
Jochem Maas wrote: > http://php.net/manual/en/function.stream-wrapper-register.php is as close as it gets I think. - total overkill for manipulating strings IMHO - (me thinks there is atleast one other in agreement) - there is a reason php has all those built in string functions :-) And ther

Re: [PHP] String to Stream

2005-08-05 Thread Jochem Maas
Eric Gorr wrote: This should be a fairly easy question for someone who already knows the answer... What I would like to be able to do is take a string and place it into a 'resource' so I can use functons like fscanf, fseek to process the string. Is this possible? If so, how? http://php.net

RE: [PHP] String to Stream

2005-08-05 Thread Jay Blanchard
[snip] Looks like it wouldn't be terribly difficult to get something like this up and running. I was just taking a look at: http://us3.php.net/manual/en/function.stream-wrapper-register.php I'm kinda surprised no one has written a wrapper for strings yet... [/snip] Perhaps because there is suc

Re: [PHP] String to Stream

2005-08-05 Thread Eric Gorr
Jay Blanchard wrote: [snip] Neither solution was particularly appealing which is why I asked the question. [/snip] I see. Sorry I couldn't be more helpful. And I thought you wore looking for a more precise function rather than the whole lot of things that can be accomplished with isstringstrea

RE: [PHP] String to Stream

2005-08-05 Thread Michael Sims
Eric Gorr wrote: > Again, I would like to treat the string as a stream. > > One possible way to accomplish this would be to simply write the > string to a temporary file, open the file with fopen and then use > fscanf, fseek, etc. to process the text. > > However, I am assuming there is an easier w

RE: [PHP] String to Stream

2005-08-05 Thread Jay Blanchard
[snip] Neither solution was particularly appealing which is why I asked the question. [/snip] I see. Sorry I couldn't be more helpful. And I thought you wore looking for a more precise function rather than the whole lot of things that can be accomplished with isstringstream. -- PHP General Mail

Re: [PHP] String to Stream

2005-08-05 Thread Eric Gorr
Jay Blanchard wrote: However, if I know what you want to do with the string more specifically (I asked for examples, which you have not given) I can get you to the right PHP functions. I am familiar with all of the PHP string functions. PHP does not have a class or function similar to isstri

RE: [PHP] String to Stream

2005-08-05 Thread Jay Blanchard
[snip] Jay Blanchard wrote: > What, exactly, do you want to accomplish? I want to be able to treat a string as a stream. [/snip] I know C++ and I know what you are talking about here. As I said before, you would have pretty high overhead to do this in PHP. However, if I know what you want to do

Re: [PHP] String to Stream

2005-08-05 Thread Eric Gorr
Jay Blanchard wrote: What, exactly, do you want to accomplish? I want to be able to treat a string as a stream. For example, the C++ STL contains istringstream, which allows one to treat strings as streams. (http://www.cplusplus.com/ref/iostream/istringstream/) If you are truly wondering w

RE: [PHP] String to Stream

2005-08-05 Thread Jay Blanchard
[snip] Again, I would like to treat the string as a stream. One possible way to accomplish this would be to simply write the string to a temporary file, open the file with fopen and then use fscanf, fseek, etc. to process the text. However, I am assuming there is an easier way (i.e. a method wi

Re: [PHP] String to Stream

2005-08-05 Thread Eric Gorr
Jay Blanchard wrote: [snip] Jay Blanchard wrote: If you place the string into a variable then you would be able to work with it that way. Using what functions? Part of the point was not to need to keep track of the current location in the string, etc...basically things that streams tend to

RE: [PHP] String to Stream

2005-08-05 Thread Jay Blanchard
[snip] Jay Blanchard wrote: > If you place the string into a variable then you would be able to work > with it that way. Using what functions? Part of the point was not to need to keep track of the current location in the string, etc...basically things that streams tend to handle well. > There

Re: [PHP] String to Stream

2005-08-05 Thread Eric Gorr
Jay Blanchard wrote: [snip] What I would like to be able to do is take a string and place it into a 'resource' so I can use functons like fscanf, fseek to process the string. Is this possible? If so, how? p.s. While I would be interested in possible alternative solutions, I would like to kno

RE: [PHP] String to Stream

2005-08-05 Thread Jay Blanchard
[snip] What I would like to be able to do is take a string and place it into a 'resource' so I can use functons like fscanf, fseek to process the string. Is this possible? If so, how? p.s. While I would be interested in possible alternative solutions, I would like to know how to accomplish this

[PHP] String to Stream

2005-08-05 Thread Eric Gorr
This should be a fairly easy question for someone who already knows the answer... What I would like to be able to do is take a string and place it into a 'resource' so I can use functons like fscanf, fseek to process the string. Is this possible? If so, how? p.s. While I would be interested