If anyone is interested in the whole code (not that long).
a colour coded, spaced link is available here
Type: Posts; User: razza
If anyone is interested in the whole code (not that long).
a colour coded, spaced link is available here
Your way seems to produce the same error too so there must be something wrong possibly elsewhere Ill keep looking in the code
I use the following to get two integers from user input, and also to check they are actually numbers...now it works fine if I enter an incorect number (say the first number) and asks me to re-enter,...
Thanks I didn't think of putting the value in ' ', which did help me spot something :)
Managed to fix it, so it works now.
int parse(char *buffer, char **v) {
int temp = 0;
while (*buffer != '\0') // if not the end of buffer yet.
{
while (*buffer == ' ' || *buffer == '\t' || *buffer ==...
well for ls for example:
ls /
(lists directory contents properly)
ls / &
ls: : No such file or directory
/:
Hi all,
Could you please look at my source at http://razza.org/source.html (its formatted, and color coded)
I have two problems, they seem to be related
1:)
when I use fgets to grab from...
yeah i gotta work on that :)
thanks for the help though hammer greately appreciated.
the output with printf is as it should be
eg i type in ls
it prints out ls
The following code works which is very similar, but its not what I want, it takes stuff from argv, I want to make a continous while loop (while 1), and run programs the user enters eg echo hello or...
can someone tell me how to make this work properly ive been trying for hours! basically it should act like a shell, and run a command.
#include <sys/types.h>
#include <sys/wait.h>
#include...
thanks buddie!
I really appreciate the help.
I'm preparing to make a very simple linux shell in c (one that will just run one program with any required arguments and perhaps later might search for the program in a path variable if its not found...
Thanks for that, I've only just started to learn how to code so any tips is always appreciated.
nevermind solved it :)
#define STRSIZE 256 just had to be changed to something higher 512 works fine..
I found out it was the line above in the file im reading from that is causing the problems, basically if you use vi to open up the file it goes past the screen and you have to scroll across to see...
Im trying to read from /proc/stat the disk_io line, and grab the first number inside the biggest bracket and print it out.
The following code works ok, if i make another file eg /somedir/robs...