Feed char array into stdin
        Posted  
        
            by 
                Brian Lindsey
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Brian Lindsey
        
        
        
        Published on 2014-08-23T03:46:36Z
        Indexed on 
            2014/08/23
            4:20 UTC
        
        
        Read the original article
        Hit count: 187
        
I am writing a parser for a mini scripting language. Some of my grammar rules require jumping to a different location in the file to obtain information. There doesn't seem to be a straightforward way to accomplish this. So, I was thinking about loading my data files into a char array array and parsing line by line. This will allow me to jump all over the array with ease.
My question is, is it possible to feed char arrays (i.e. char *) into stdin, so I can easily invoke the yyparse() function as needed.
© Stack Overflow or respective owner