Jump to content

STRBUFFER


Recommended Posts

Hello,

Here's a piece of my code.

$foo = Run(".\prog.exe /d", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
$line = StdoutRead($foo)

Very simple isn't it? The problem is that the string that is returned by the prog is bigger than the size of a general string buffer limitation (4095 chr). So i got a part of it....

How can i increase the buffer size so that i can handle the whole string?

Thanks :P

Link to comment
Share on other sites

Hello,

Here's a piece of my code.

$foo = Run(".\prog.exe /d", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
$line = StdoutRead($foo)

Very simple isn't it? The problem is that the string that is returned by the prog is bigger than the size of a general string buffer limitation (4095 chr). So i got a part of it....

How can i increase the buffer size so that i can handle the whole string?

Thanks :P

Does this work?

Dim $line
  $foo = Run(".\prog.exe /d", "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
  While 1
    $line &= StdoutRead($foo)
    If @error = -1 Then ExitLoop
  WEnd

The above assumes that your own script is more-or-less complete and that the child prog.exe will exit while we're reading the data; when it exits it will close its STDOUT pipe and a final call to StdoutRead will return empty and set @error to -1. If your script is a script fragment then you could just call StdoutRead several times or use a While loop like the above and test the size of $line at the top of the loop...

Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

Link to comment
Share on other sites

It works, &= was the key.

I presume that the prog send a part of the datas, then relaunch itself to send another part, so if not using &=, only first wave of datas was in the $line. (while using $= 'add' all parts until prog is over).

Did i get it?

Thank you very much :P

Link to comment
Share on other sites

It works, &= was the key.

I presume that the prog send a part of the datas, then relaunch itself to send another part, so if not using &=, only first wave of datas was in the $line. (while using $= 'add' all parts until prog is over).

Did i get it?

Thank you very much :P

Well, maybe not relaunch, but it could have been two or more seperate "prints" or you may have had it in your first post; the prog wrote as much as it could until its STDOUT buffer filled up, then waited until AutoIt could read the data and empty the buffer before writing again. Don't know without knowing how the child program is put together...

Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...