-
Hey, I want to capture a screenshot on Rohde and Schwarz Spectrum Analyser via ethernet commands and then automatically retrieve that screenshot to my PC location via ethernet TCPIP but im not able to retrieve the screenshot back after taking the screenshot.
Kindly Help me with this ,Currently im trying with the below code :
//Send the command to capture a screenshot strcpy(buffer, ":DISPlay:DATA? PNG, COLor"); if (send(sa_socket_desc, buffer, strlen(buffer), 0) < 0) { perror("Send error"); exit(1); } // Receive the screenshot data fp = fopen("screenshot.png", "wb"); if (fp == NULL) { perror("File open error"); exit(1); while ((bytes_read = recv(sa_socket_desc, buffer, BUFFER_SIZE, 0)) > 0) { fwrite(buffer, 1, bytes_read, fp); } fclose(fp); -
Hey, I want to capture a screenshot on Rohde and Schwarz Spectrum Analyser via ethernet commands and then automatically retrieve that screenshot to my PC location via ethernet TCPIP but im not able to retrieve the screenshot back after taking the screenshot.
Kindly Help me with this ,Currently im trying with the below code :
//Send the command to capture a screenshot strcpy(buffer, ":DISPlay:DATA? PNG, COLor"); if (send(sa_socket_desc, buffer, strlen(buffer), 0) < 0) { perror("Send error"); exit(1); } // Receive the screenshot data fp = fopen("screenshot.png", "wb"); if (fp == NULL) { perror("File open error"); exit(1); while ((bytes_read = recv(sa_socket_desc, buffer, BUFFER_SIZE, 0)) > 0) { fwrite(buffer, 1, bytes_read, fp); } fclose(fp);@Pariposh
Code above should workbut has nothing to do with Qt. Since all it does is save every byte received to a file nobody can know what the issue in your case might be.EDIT
Oh, hang on a minute, your code is not right! Look at when/where you have set yourwhileloop to execute :) -
@Pariposh
Code above should workbut has nothing to do with Qt. Since all it does is save every byte received to a file nobody can know what the issue in your case might be.EDIT
Oh, hang on a minute, your code is not right! Look at when/where you have set yourwhileloop to execute :) -
@JonB i gaave some debug prints in the above code already and got to know that there is some issue in the while loop only , but im not getting how to resolve that issue.
@Pariposh said in Saving Screenshot from Rohde and Schwarz Spectrum Analyser to PC:
but im not getting how to resolve that issue
What about telling us what that issue actually is?
-
@JonB i gaave some debug prints in the above code already and got to know that there is some issue in the while loop only , but im not getting how to resolve that issue.
-
S SGaist moved this topic from General and Desktop on
Qt 6.11 is out! See what's new in the release
blog