The 2024 Wheel Reinvention Jam is in 16 days. September 23-29, 2024. More info

Is there a way to start debugging a program while using a file for stdin ( remedy version 0.3.8.4)?

Hello,

I'm using remedy for some coding practice sites and these invariably require that I have to read inputs from a testcases file. Is there a way to start a program inside remedy such that it will take the stdin from a file? I tried putting < testcases.txt in the command field but then it can't run the executable.

I also tried putting it in the arguments like this. This works in visual studio.

image.png


Edited by Gaurav Gautam on

Don't know about remedy, but you can always reopen stdin/out streams during debugging/development:

freopen("testcases.txt", "r", stdin);

Hello Sir !

If you have the source code of the app, you can modify your main to have a waitloop

int main()
{
    while(!IsDebuggerPresent()); // Loop without doing anything
    __debugbreak(); // Trigger a breakpoint once the debugger is attached and ready

    ... // Rest of the app
}

And run it from the terminal and then attach Remedy and it will automatically break on the __debugbreak();

Cheers

Reference:
https://learn.microsoft.com/en-us/windows/win32/api/debugapi/nf-debugapi-isdebuggerpresent
https://learn.microsoft.com/en-us/cpp/intrinsics/debugbreak?view=msvc-170


Edited by Scr3amer on

ah thankyou! This solves other problems I was having too.


Edited by Gaurav Gautam on
Replying to mmozeiko (#29320)

Thankyou! This should work for my purposes.


Replying to Scr3amer (#29321)