LOL yea i just realized that
sorry for the post and thanks
Type: Posts; User: exvor
LOL yea i just realized that
sorry for the post and thanks
here is the code
/* A simple computer simulator */
#include<stdio.h>
#define SIZE 100
int main()
Sorry man page is kinda clusterd with scanf and sscanf and fscanf
so I just checked it real fast. when i replied as to what is wrong
in the above code im not sure yet as I couldent find this...
.....doesnt.... mac osx come with gcc ???
or did they remove that when they stole the nextstep code :)
Google is your friend i have found several tutorials on
gtk and networking and xlib and many others. this is of course
if your not wanting to program in windows :)
They covered linked lists before they coverd typedef ???
dont sound like a very good book :p
Like i said doesent matter. With a good compilier like gcc its really a mute point. But i do understand why its not needed. :)
why is recasting the pointer from malloc incorrect. malloc returns a void pointer if your puting into a char pointer recasting would be correct. But again this is a mute point as this has been...
ok i think i have it tracked down here
error = ((sscanf(line," %d", &n) != 1 || n <= 0) && (digit == 1));
this error checking will not work if both a letter and a number are enterd...
wow talk about unreadablity
the whold error thing is messin me up
what is your while statement checking for?
ill continue to try and understand what you were doin here but if i
...
Ahh i see. So even if you use malloc to only allocate 4 bytes and you shove more data into the pointer to the 4 bytes of memory then scanf will read the entire string. I thought that scanf would...
also this used to be a function to a main program in another source file so this may be why it looks bad and the comments here make little sense.
yes but shouldent it messup because the memory allocated for data is too small to hold the entire string of data.
its called a buffer overrun because the data in the buffer stdin is longer then...
Here is a small program i have written and I cannot figure out why my keyboard buffer is not behaving bad like it shouldwith this flawed code.
also keep in mind this is not all of the code the...
I just read the man page for setbuf and yea your right that does not make alot of sense.
lol well at least you got me to look at the man page :D now i know what setbuf does YAY !
haha quzah you crakin me up over here
anyway ive done this program when learning C and belive me dont feel bad i really messed mine up worse then this. LOL but i wont put people here though my...
inline bool Flush_Stream(FILE* stream)
{
void* p = malloc(BUFSIZ);
if (p == NULL)
{
return false;
}
else
setbuf(stream, p);