Search:

Type: Posts; User: DeanWinchester

Page 1 of 8 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    6
    Views
    4,341

    Thanks buddy, I was missing a fclose(). Thanks...

    Thanks buddy, I was missing a fclose().

    Thanks a lot! :)
  2. Replies
    6
    Views
    4,341

    Hello Jim, thanks for your reply. I'm well...

    Hello Jim, thanks for your reply.

    I'm well aware but fscanf is working, as I've mentioned in the first post, it's working and creating the textfiles, it's only doing that when I compile the...
  3. Replies
    6
    Views
    4,341

    I managed to find out that when he reads the...

    I managed to find out that when he reads the file, this file is empty.
    Is there any way I can refresh a folder in C?
  4. Replies
    6
    Views
    4,341

    Refresh a file

    Hello everyone, I might be need your help in a thing that has been bothering me.

    I have a function called map() that creates a file called 'merdas.txt' and writes to it.
    After that, I call a...
  5. Replies
    24
    Views
    2,249

    Alright, my mate managed to get it working! ...

    Alright, my mate managed to get it working!

    Thanks so much! :)
  6. Replies
    24
    Views
    2,249

    Thanks. It's printing the pids as following : ...

    Thanks.
    It's printing the pids as following :

    pid: 1355
    pid: 0
    pid: 0

    On the father, it's already reading two lines from the the exec output :
  7. Replies
    24
    Views
    2,249

    My whole function right now looks like this : ...

    My whole function right now looks like this :



    void map(char* cmd, char* arg){
    int i;
    int d=0;
    int pid = fork();
    FILE *stream;
    int status;
  8. Replies
    24
    Views
    2,249

    I don't think the child is going to the father...

    I don't think the child is going to the father process.
    What I think and know is my program isn't entering here :

    else if (pid==0)
    {
    dup2(fd[1],1);
    printf("son\n");
    ...
  9. Replies
    24
    Views
    2,249

    Yes, I did change it to that and still it ain't...

    Yes, I did change it to that and still it ain't working.
    I completely have no idea why he just doesn't enter the son part instead of the dad part .. :/
  10. Replies
    24
    Views
    2,249

    I've sorted my types out, thanks. Hmm, so...

    I've sorted my types out, thanks.


    Hmm, so having the child pid 0 where should I have my waitpid ?


    I need it to enter the son first :


    if(pid==0) // filho
  11. Replies
    24
    Views
    2,249

    Doing instead waitpid(-1, status, 0); ...

    Doing instead


    waitpid(-1, status, 0);


    Managed to cut the error out but still it won't work >_>
  12. Replies
    24
    Views
    2,249

    cc1: warnings being treated as errors soluis2.c:...

    cc1: warnings being treated as errors
    soluis2.c: In function ‘map2’:
    soluis2.c:93: warning: format ‘%s’ expects type ‘char *’, but argument 4 has type ‘char (*)[1000]’
    soluis2.c:93: warning:...
  13. Replies
    24
    Views
    2,249

    Thanks for the kind replies and explanation. I...

    Thanks for the kind replies and explanation.
    I found out what's happening, I just do not know how to solve it.

    Thing is my wait function isn't working, this :


    else
    waitpid(-1,...
  14. Replies
    24
    Views
    2,249

    I've changed my whole function. It looks like...

    I've changed my whole function.
    It looks like this now :



    void map(char* cmd, char* arg){
    int i;
    int d=0;
    int pid;
    FILE *stream ;
  15. Replies
    24
    Views
    2,249

    Done aswell, thanks for the tip.

    Done aswell, thanks for the tip.
  16. Replies
    24
    Views
    2,249

    Here it is Salem : void map(char* cmd,...

    Here it is Salem :



    void map(char* cmd, char *arg){ int i;
    int pid;
    int fd[2];
    char* buffer;
    char* novo;
    int status;
  17. Replies
    24
    Views
    2,249

    Tried that. After ...

    Tried that.
    After


    read(fd[0],buffer,strlen(arg));


    I have this printf :
  18. Replies
    24
    Views
    2,249

    Communication through pipes

    Hello everyone,
    I'm trying to communicate between father and son processes using pipes.

    Wouldn't this be the proper way for the son to communicate with his father ?





    else if(pid==0) {
  19. Replies
    2
    Views
    1,240

    Redirect stdin to stdout - Pipe

    Hello guys,

    my input on the terminal should be something like this :



    ./mapreduce du "wc -l"


    In which du is the map argument and "wc -l" is reduce's argument.
  20. Replies
    10
    Views
    1,112

    Declared str as static and worked just fine....

    Declared str as static and worked just fine.
    Thanks bud!
  21. Replies
    10
    Views
    1,112

    Returning a String

    Hello everyone,
    I'm trying to return a string to then call it on main function.

    My code is the following :



    const char* coiso(int chave){
    char str [50];
    sprintf(str,"%d",chave);
  22. Replies
    26
    Views
    2,842

    Thanks so much. You're the best guy ever....

    Thanks so much.
    You're the best guy ever.
    You're best than my teachers, you explain everything so detailed! :)
  23. Replies
    26
    Views
    2,842

    Now what I want to do is : I want to read line...

    Now what I want to do is :

    I want to read line by line.
    After reading the first line,
    I should read until the number is over and when this is done I should add the number to the key field in the...
  24. Replies
    26
    Views
    2,842

    72 . 16 ./.DS_Store 8 ./a 8 ./lerficheiro.c...

    72 .
    16 ./.DS_Store
    8 ./a
    8 ./lerficheiro.c
    8 ./o
    24 ./so
    8 ./so.c
    File '/Users/machd/Desktop/SistemasOperativos2013/GuardaLinhas/merdas.txt' read successfully.

    Thanks sir, worked just fine.
  25. Replies
    26
    Views
    2,842

    Hmm, understood. Thanks so much. Well, what's...

    Hmm, understood.
    Thanks so much.

    Well, what's inside.

    I got this piece of code to read what's inside the text file :


    while(!feof(fp)){
    fgets(buffer,200,fp);
Results 1 to 25 of 188
Page 1 of 8 1 2 3 4