Hiding CMD window using C++
Go to solution
Solved by WereCatf,
14 minutes ago, Shammikit said:hello i have got Qprocess working and in my case im getting 2 lines as output.If im accessing the second output only, how can i achieve this. is there a way to remove the first line of output or is there a way to tell to read the 2nd line only?
It'd help, if you showed the output you're getting. That said, there are multiple ways of skinning the cat, like e.g. using strchr() or strtok(). Here's a quick example of how to do it using strchr():
#include <stdio.h> #include <string.h> int main () { char multiString[] ="First line of text.\nSecond line of text."; char *singleString = NULL; //Always initialize pointers! singleString = strchr(multiString, '\n'); //Look for newline-character if(singleString != NULL) singleString++; //Skip the newline-character if(strlen(singleString)) printf("Output: %s\n", singleString); return 0; }
This example will produce:
QuoteOutput: Second line of text.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now