Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CR at the end of tab-delimited lines

Status
Not open for further replies.

phuzzy42

IS-IT--Management
Nov 19, 2005
143
0
0
US
I'm using Aspect to read a tab-delimited file for making lots of changes in a PBX all at once:
Code:
proc main

  string sLine, varTN,varTYP,varDN1,varDN2,varNAM
  fopen 0 "scr.txt" READ

  transmit "****^M"
  waitfor ">"
  transmit "ld 20^M"

  while not feof 0
    fgets 0 sLine
    strtok varTN sLine "`t" 1
    strtok varTYP sLine "`t" 1
    strtok varDN1 sLine "`t" 1
    strtok varDN2 sLine "`t" 1
    strtok varNAM sLine "`t" 1
Data reads in fine and I send to the PBX fine. The problem is the last column read from the file also picks up the carriage return at the end of the line. I added an extra tab (dummy column) to each line to make it work.

My question is whether this is "normal" behavior and is there a way to avoid this without always adding an extra column. If I leave off or make the '1' a '0' in the last strtok line (strtok varNAM sLine "`t" 1 in this case) will that do the trick?

Steve Harmon
Greenfield, Indiana
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top