Ok here is my structure...
typedef struct stock_details
{
char stckno[3];
char name[15];
char description[30];
char price[6];
}stock_data;
that i get...
then i use fgets and, fseek to get the input and get rid of any null values... like so:
fgets(stck1.stckno, 2, stdin); //get input
fseek(stdin, 0, SEEK_END); //dicard xtra
fgets(stck1.name,14, stdin);
fseek(stdin, 0, SEEK_END);
fgets(stck1.description, 29, stdin);
fseek(stdin, 0, SEEK_END);
fgets(stck1.price, 5, stdin);
fseek(stdin, 0, SEEK_END);
problem is when i input this into a text file the text is all over the place because it is reading enter keys... any way to get rid of them? oh and i already blanked the variables too... eg stockno has " " entered into it futher up my code...
any help appreciated