Search code examples
c++ccodeblockstestcase

Is it posible to run some case tests from a file using codeblocks without using file functions


I have the following tests below in a file and I want to run these tests but i do not want to type all of them and neither change my code which is using scanf to fscanf to read from a file, is it possible using CodeBlocks?

Sample Input 

2
3
a b c A B C
a:BAC
b:BAC
c:ACB
A:acb
B:bac
C:cab
3
a b c A B C
a:ABC
b:ABC
c:BCA
A:bac
B:acb
C:abc

Solution

  • It is possible using terminal and stream redirection and pipes. Here's some link from google assuming you are using linux: https://www.digitalocean.com/community/tutorials/an-introduction-to-linux-i-o-redirection

    You probably need something like this (pipe):

    $ cat your_file | your_binary
    

    or (stream)

    $ your_binary < your_file