mercredi 1 avril 2015

How to move data from an array to the buffer when a program starts?

Is there a way to have the data in an array of characters or integers to be placed in the buffer when the programs starts as if the user has entered this data?


For example:



int main()
{
int run = 1;
char a[] = "4\nasdfg\0";
char in = NULL;

datatobuffer(a);//is there a command for this in C?

while (run){
in = getchar();
if (in == '\0')
run = 0;
}
//loop stopped, user didn't do anything
}


Alternatively, is there a way to do this in the debugger of VS?


This is for testing several functions that rely on user input so I want to automate the process of entering data.


Aucun commentaire:

Enregistrer un commentaire