SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 8 of 8
  1. #1
    Junior Member
    Join Date
    Sep 2005
    Location
    uk
    Posts
    25
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    How to send data without carriage line feed ?

    Hi,

    I have to create a script that will create a text file with data like 25.This file will be read by the server.

    The problem is when I used write or print statements, along with data it has added carriage line feed or a tab space.The server read the data but failed to do further process because of the added blank space.

    Is there any way where I can only send data without any space???

    Thanks in advance.

  2. #2
    Senior Member
    Join Date
    Sep 2001
    Location
    Philly
    Posts
    1,231
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to send data without carriage line feed ?

    if the data has those chars as part of it before you write it to the file, use a Replace to get rid of the unwanted characters.

    theText = Replace(theText,vbCrlf,"")
    ~Alias~

  3. #3
    Junior Member
    Join Date
    Sep 2005
    Location
    uk
    Posts
    25
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to send data without carriage line feed ?

    No actually I have to send only data ex 25. I created a text file and typed 25 and saved it manually. The server read the file as there was no space.But with write or print, some spaces are introduced and the server did not process because of added spaces.

    my code:

    n = 15

    'Get the free file number
    ipfile = FreeFile

    'Assign the address of the text file
    strfile = "C:\Data\File\Data"

    'Open the text file
    Open strfile For Output As #ipfile
    Print #ipfile, n
    Close #ipfile

    [ 11-02-2005, 06:07 AM: Message edited by: TUPIND ]

  4. #4
    Senior Member
    Join Date
    Sep 2001
    Location
    Philly
    Posts
    1,231
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to send data without carriage line feed ?

    how about...

    n = "15"

    or

    dim n as long
    n = 15
    ~Alias~

  5. #5
    Junior Member
    Join Date
    Sep 2005
    Location
    uk
    Posts
    25
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to send data without carriage line feed ?

    Thank you but when I used "15", the data is stored as "15" hence different from 15.

    When I used long, there is no change.
    With write stmt, a carriage return–linefeed is inserted and with print a blank space before after 15 is inserted.
    With Print, we can use tab option to increase these spaces but I am unable to find out how to print without spaces.

  6. #6
    Senior Member
    Join Date
    Sep 2004
    Location
    Toronto, Canada
    Posts
    555
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to send data without carriage line feed ?

    Try this;

    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">n = 15

    'Get the free file number
    ipfile = FreeFile

    'Assign the address of the text file
    strfile = &quot;C:\Data\File\Data&quot;

    'Open the text file
    Open strfile For Output As #ipfile
    Print #ipfile, trim(str(n));
    Close #ipfile</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">Aracknid.
    TestPartner:
    Current AUT running test scripts on TP 6.3 build 183, SQL 2000 DB.
    Legacy AUT running on TP 5.6.0 Build 81 and TP 6.2 build 449 with SQL 2000 DB.

    Test Environment:
    TP/IE Clients on VMWare ESX 4.1 server, AUT Servers on VMWare ESX 3.5 server.

    Application Under Test (AUT):
    Client/Server based, IE 7/8 interface with SQL 2005/2008 DB.

    Automating with TP since August 2004.

  7. #7
    Senior Member
    Join Date
    Sep 2004
    Location
    Toronto, Canada
    Posts
    555
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to send data without carriage line feed ?

    I should explain what I did. When you convert an integer to a string, it reserves room for the positive/negative indicator (even though you don't see the + ), which is why you get a space at the start. Also, to avoid inserting the CR/LF, use the semi-colon to remain on the same line. If you were to print another line, it would put it right after the other number. So if you don't want this, remember to only print the last line with the semi-colon.

    Aracknid.
    TestPartner:
    Current AUT running test scripts on TP 6.3 build 183, SQL 2000 DB.
    Legacy AUT running on TP 5.6.0 Build 81 and TP 6.2 build 449 with SQL 2000 DB.

    Test Environment:
    TP/IE Clients on VMWare ESX 4.1 server, AUT Servers on VMWare ESX 3.5 server.

    Application Under Test (AUT):
    Client/Server based, IE 7/8 interface with SQL 2005/2008 DB.

    Automating with TP since August 2004.

  8. #8
    Junior Member
    Join Date
    Sep 2005
    Location
    uk
    Posts
    25
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How to send data without carriage line feed ?

    Thanks Aracknid.Now the server has read the file and processed.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.34%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 08:06 PM.

Copyright BetaSoft Inc.