Search:

Type: Posts; User: Schwarzhelm

Search: Search took 0.01 seconds.

  1. Replies
    1
    Views
    2,193

    Detect Close of a background process

    Right now I have a program that executes another program and lets it run in the background. I want to know when the background process quits. I also want to know which background process quits, I...
  2. Replies
    3
    Views
    5,834

    I don't think my question was answered correctly....

    I don't think my question was answered correctly. I don't want to wait because I want the program to run in the background, in this case the ps command. While it's running in the background I want...
  3. Replies
    3
    Views
    5,834

    Double Fork Problem

    I am having problems with running a child in the background. I want the child to run and then keep the parent active.

    This is what keeps happening:
    PID TTY TIME CMD
    16844 pts/0 ...
  4. Replies
    1
    Views
    1,469

    execlp and File input

    Hello,

    I'm trying to run a program via execlp and then fill it's input from another file.

    Ideally it is going to mimic file<input. I've been playing with fgets and fgetc but I can't figure out...
  5. Replies
    1
    Views
    3,009

    execlp output to file

    Is there a way to get the output from running another command via execlp to output to a file?

    Right now I am experimenting with fopen but I can't figure out what to do..

    Any suggestions?
    ...
  6. Replies
    19
    Views
    4,394

    When I delcare command as static it hangs my...

    When I delcare command as static it hangs my program..... It appears to hang on the fgets. If I put a printf before it it will print but if I put one after it, it won't get there. Any Ideas?
    ...
  7. Replies
    19
    Views
    4,394

    Here is readCommandLine char *...

    Here is readCommandLine




    char * readCommandLine()

    {
    char command[100];
    char *p;
  8. Replies
    19
    Views
    4,394

    It still messes up... After my fork I lose the...

    It still messes up... After my fork I lose the variable even when I try to print it, it prints a ?... any other suggestions?

    Here's my main again with not as much stuff commented out... It may...
  9. Replies
    19
    Views
    4,394

    Sorry about all the commented code. I was trying...

    Sorry about all the commented code. I was trying to comment out all the calls to the other sub routines that I didn't post here. I also have been playing with the stuff around the fork to see if I...
  10. Replies
    19
    Views
    4,394

    #include #include #include...

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <sys/types.h>
    #include <sys/stat.h>
    #include <dirent.h>
    #include <fcntl.h>
    #include <time.h>
    #include <sys/param.h>
  11. Replies
    19
    Views
    4,394

    That worked ... hmm that leaves me in a mess...

    That worked ... hmm that leaves me in a mess now.. ok it works if I define the variable directly like you did. hmm what could i be doing wrong?

    The user inputs a commad and it holds until fork....
  12. Replies
    19
    Views
    4,394

    Isn't ls ls what I want? when I hard code ls in...

    Isn't ls ls what I want? when I hard code ls in there then it works... again the variable is losing its value before it gets there


    I just don't understand why it is losing its value ... I can...
  13. Replies
    19
    Views
    4,394

    I don't know if that's the issue.. when I print...

    I don't know if that's the issue.. when I print execCommand it comes up as ??'s.. it appears to lose it at the fork... anyway I delcared execCommand as a char by char * execCommand=malloc(100).

    I...
  14. Replies
    19
    Views
    4,394

    Problem with Fork()

    After I fork I appear to lose my variable the first time I try to execute a program. It will run the 2nd, 3rd,.... time but not the first. Below is my code.
    This is part of the shell code I am...
  15. Replies
    13
    Views
    1,408

    That still doesn't work ... and now it just...

    That still doesn't work ... and now it just prints
    CPU Type: ???????VB

    I think my sscanf order is fine... Like I said before it works fine if I print in my getCPUType sub, but when I try to...
  16. Replies
    13
    Views
    1,408

    I don't think the sscanf is my problem. If I...

    I don't think the sscanf is my problem. If I print directly from my Get sub it works fine, but I don't want to to that. I want the information to be printed from my Main.
  17. Replies
    13
    Views
    1,408

    I'm sorry I guess I don't understand... could you...

    I'm sorry I guess I don't understand... could you please explain a little more..

    thank you
  18. Replies
    13
    Views
    1,408

    Still no go.. I added a =malloc(100); in my code...

    Still no go.. I added a =malloc(100); in my code after the declarations. So my code in my main and bassically whereever else I had it written looks like this:



    char* CPUType=malloc(100);

    ...
  19. Replies
    13
    Views
    1,408

    Problem returning a string

    I keep having problems when I'm returning a string from my sub. It keeps printing:
    CPU Type: Auth(????VB
    CPU Model: AMD
    when I print.

    Here is my code:


    char * GetCPUType()
    {
  20. was previously implicitly declared to return `int'

    I keep getting the error `GetCPUType' was previously implicitly declared to return `int'. I can't figure out what I'm doing wrong. Here is my code.



    // this is in my main method.
    printf("CPU...
  21. Replies
    2
    Views
    2,042

    I have buf declared as a char *buf. I tried the...

    I have buf declared as a char *buf. I tried the code that was suggested and it is still getting a segmentation fault. filename is dirp->d_name after a lstat.

    Thank you.
  22. Replies
    2
    Views
    2,042

    readlink segmentation fault

    if( S_ISLNK(mode) )
    {
    type = 'l'; /*symlink*/
    readlink(fileName, buf, sizeof(buf));
    printf("\n %s \n",buf);


    }
  23. Thread: Macros

    by Schwarzhelm
    Replies
    4
    Views
    1,376

    Macros

    I have a question about using macros in C.
    First, I am trying to divide and return both the answer and the remainder from a macro. Right now I have:


    #define DIVMOD(x,y,d,r) ((y)==0 ? d=0; r=0...
Results 1 to 23 of 23