>Hi every body
>
>I have one text file containing 55,000 records. All the fields are in fixed spaces. When I check in DOS the spaces are ok. But when I use import wizard (VFP 6), it gives the text in improper spaces, looks like some spaces are missing and the remaining fields are loosing their width. It is not possible to use commas to separate the fields. Is there any way to use this text file that all the spaces should be the same as it looks in DOS (edit text file).
>
My guess is that you're displaying the file with a proportional font, so the columns don't align well (try changing the font to Courier New), or that there are embedded tabs in place of some spaces; you need to convert the tabs to spaces (a tab may expand to 1-8 spaces, depending on the character position, and you'd have to preprocess the file to do this conversion to make things fixed width.
Hopefully, changing the display font to a monospaced font will solve the problem, otherwise, you need to write code to scan the text file line-by-line and write code to expand spaces into a fixed number of space characters. It must be processed line-by-line, first character to last, since each time you replace a tab with spaces, you change the position of all the characters that follow it.
FUNCTION ConvertTabsToSpaces(tcInputFile,tnNumSpacesPerTab)
LOCAL cInputString, aStringLines(1), cThisLine, nPosn, nCtr, nLines, nSpaces, cTab, cCRLF
IF TYPE('tnNumSpacesPerTab')#'N'
tnNumSpacesPerTab = 8
ENDIF
cTab = CHR(8)
cCRLF = CHR(13) + CHR(10)
cInputString = FILETOSTR(tcInputFile)
nLines=ALINES(aStringLines,cInputString)
cInputString = ''
FOR nCtr = 1 TO nLines
cThisLine = aStringLines[nCtr]
nPosn = AT(cTab,cThisLine)
DO WHILE nPosn # 0
nSpaces = tnNumSpacesPerTab - MOD(nPosn-1,tnNumSpacesPerTab)
cThisLine = STUFF(cThisLine,nPosn,1,SPACE(nSpaces))
nPosn = AT(cTab,cThisLine)
ENDDO
cInputString = cInputString + cThisLine + cCRLF
ENDFOR
=STRTOFILE(cInputString,tcInputFile)