Hello Guest it is September 17, 2021, 03:05:34 AM

Author Topic: string problem ""  (Read 320 times)

0 Members and 1 Guest are viewing this topic.

string problem ""
« on: July 21, 2021, 04:10:56 AM »
hello
I want save DRO in the external file but keep first line. when read first line and write to new file. it saved by added "".
For example the first line( that want keep it) is screw01. after running code 5 time the first line is """""screw01""""".
how to remove "". thanks
Code: [Select]
Dim fich As String
Dim FileData As String
fich="offset_"&GetUserDRO(1000)&""
If Dir(fich)="" Then
MsgBox fich&&" not found"
Else
Open fich For Input As #1
Line Input #1, FileData
namedesc=FileData
Close #1
End If
Open fich For Output As #2   ' Open to write file.
Write #2, (namedesc) 'problem
For x = 1000 To 2255
DROState = GetUserDRO(x)
Write #2, DROState
Next x
Close #2
Message "save done!"

Offline TPS

*
  •  2,201 2,201
    • View Profile
Re: string problem ""
« Reply #1 on: July 24, 2021, 07:36:19 AM »
try to use this:
Code: [Select]

namedesc = Mid(FileData,2,Len(fileData)-2)

anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Re: string problem ""
« Reply #2 on: September 12, 2021, 04:36:49 AM »
thank you TPS. it works well by your code. :)