Transform in string..

New to FreeBASIC? Post your questions here.
Posts: 18
Joined: Jun 22, 2008 0:31
Location: Brazil

Transform in string..

Postby h3llm45t3r » Aug 17, 2008 21:31

someone help me xD~~..

i want to enter a code on cmd by fbid .. and transform one line on a string ..
for a example .. i want to read HOST NAME ( computer name ) with "systeminfo" commando ..

cmd.exe /c "systeminfo | find "Host name"
cmd.exe /c "systeminfo | find "Nome do host" ( in portuguese )

the result is:
Nome do host: CRAZY-PC2

i want to transform this result in a string .. ^^ ..

if someone know this .. please say me xD~~

obs: sorry by the bad english ;x
Posts: 605
Joined: Feb 18, 2006 13:30
Location: Alexandria / Egypt

Postby voodooattack » Aug 17, 2008 22:34

Code: Select all

    dim cmd as string = !"systeminfo | find \"Host Name\""

    open pipe cmd for input as #1
            dim s as string
            input #1, s
            print s
        loop until eof(1)
    close #1

and now the proper method:

Code: Select all

    #include ""
    dim l as integer
    dim pcName as string
    pcName = space(l)
    print pcName

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 2 guests