Where does C code printf output go?

Moderators: TomKerekes, dynomotion

Post Reply
skeitzer
Posts: 4
Joined: Sun Mar 28, 2021 1:49 am

Where does C code printf output go?

Post by skeitzer » Sun Aug 15, 2021 2:28 am

Apparently I do not understand how the printf works..

I thought using kmotionserver I could have multiple PC programs communicate with KFLOP

1. Execute KMOTIONSERVER.EXE
2. Execure KMOTION, bring up the CONSOLE screen
2a. Test the console: click 'version'.. version sent from KFLOP as expected
3. Run KMOTIONCNC
3a. Tool Setup/ User Buttons
3b. Key 121, Button nams: Test, action: Execute Prog, Thread 4/ C File "print.c"
3c. OK/ exit to main screen
3d. Click the new 'Test' button
3e. Expected to see 'Hello World' on the KMOTION console screen.. but nothing..
3f. In the folder with print'c, there is not a print.out

where is the output going?

User avatar
TomKerekes
Posts: 2529
Joined: Mon Dec 04, 2017 1:49 am

Re: Where does C code printf output go?

Post by TomKerekes » Mon Aug 16, 2021 1:53 am

Hi skeitzer,

That should work. But you shouldn't run KMotionServer.exe. that should happen automatically. But I wouldn't expect it to normally cause a problem unless you are executing an improper KmotionServer.exe

Console messages are different from command responses. Unsolicited Console messages go to the last application that registered to receive the Console messages. Command responses go to the application that sent the command. So for example if 5 apps sent the Version command each app would receive the Version response. And if 5 apps executed a program to print, all prints would all go to the app last registered to receive console messages.

I assume you misstyped print'c but meant print.c ? print'c wouldn't work

Compiling print.c should create an executable print(n).out where n is the Thread it is compiled for.

Are you doing things or making changes that you are not telling us?

Regards
Regards,

Tom Kerekes
Dynomotion, Inc.

skeitzer
Posts: 4
Joined: Sun Mar 28, 2021 1:49 am

Re: Where does C code printf output go?

Post by skeitzer » Tue Aug 17, 2021 1:18 am

Thanks..

Console output in Kmotion from C program initiated in KmotionCNC is now working fine..
Don't know why.. maybe my starting KmotionServer manually was the issue..

Post Reply