Well, whereever i read it... it was wrong... i added a parameter (11) to your code and it worked fine!
lcstring = "TEST STRING"
lnhandle = FOPEN("COM1:",11)
?lnhandle
IF lnhandle <> -1
Fwrite(lnhandle,lcstring,len(lcstring))
FCLOSE(lnhandle)
ENDIF
Tanks a lot!!
>Nothing happens...
>
>I don´t remember where I read that comm ports can´t be opened with fopen() in VFP... (maybe in help files..)
>
>>Have you tried fopen?
>>
>>lcstring = "TEST STRING"
>>lnhandle = FOPEN("COM1:")
>>IF lnhandle <> -1
>> FWRITE(lnhandle,lcstring,len(lcstring))
>> FCLOSE(lnhandle)
>>ENDIF
>>
>>
>>
>>>Hi.
>>>I need to send a string to the communications port COM1:
>>>Is there any way other than adding a commcontrol to a form??
>>>
>>>I found a piece of code posted by Ed Rauh, (post # 12708):
>>>
>>>
>>>DECLARE INTEGER CopyFile IN KERNEL32.DLL ;
>>> STRING @SourceFileName, ;
>>> STRING @DestFileName, ;
>>> INTEGER bFailIfExists
>>>IF CopyFile(cMySourceFileName,cMyPortOrUNC,0) # 0
>>> * It was copied
>>>ELSE
>>> * it wasn't
>>>ENDIF
>>>
>>>
>>>
>>>It sends a FILE, wich makes me to write a file containing the string i want to send... by now, it works for me.. but my doubt persists.. how can I send just a string??
>>>
>>>Thanks in advance.