User Profile

Collapse

Profile Sidebar

Collapse
jewel87
jewel87
Last Activity: Mar 2 '08, 10:56 PM
Joined: Jan 28 '07
Location: London
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • jewel87
    replied to Need help on pipes!
    I have tried it also like this:
    Code:
    #include <stdio.h>
    
    main()
    {
    
       char buff[2];
       int odd =1;
       int count =1;
       int flag =0;
       int even =2;
    
       int p[2], pid1, pid2, pid3;
       pipe(p);
       pid1 = fork();
       pid2 = fork();
       pid3 = fork();
    
    while(count < 21)
       {
            if (( pid1 > 0 )&&(
    ...
    See more | Go to post

    Leave a comment:


  • jewel87
    started a topic Need help on pipes!

    Need help on pipes!

    Hello everyone,
    I have problems with my code in C doing pipes. It is currently running into an indefinite loop, but I was trying all possible modifications I could think of, nothing have led me to the solution.
    I have this task:
    Write a program that creates three processes, two write down the pipe and one that reads from the pipe. The first child process writes the first 20 odd integers, and the second child process writes the...
    See more | Go to post

  • jewel87
    replied to Segmentation fault
    as far as i understand, it doesn't even enter the child processes at all, otherwise at least it would print the messages "Odd number" and "Even number"....
    See more | Go to post

    Leave a comment:


  • jewel87
    replied to Segmentation fault
    Thanks, i've changed it to char buff[2];
    but now i'm getting output as:
    Number read:
    Number read:
    Number read:
    Number read:
    ...
    it basically does not write anything to the pipe. What is wrong??...
    See more | Go to post

    Leave a comment:


  • jewel87
    started a topic Segmentation fault

    Segmentation fault

    Hi everyone!
    I am writing a program in C under UNIX, the task basically is this:

    create three processes, two write down the pipe and one that reads from the pipe. The first child process writes the first 20 odd integers, and the second child process writes the first 20 even integers. Make the reading process (the third child process) print any messages it receives on its standard output. Find out a solution and modify the program...
    See more | Go to post

  • jewel87
    replied to parent and child processes
    Thank you very much for your help, Arul !!!
    See more | Go to post

    Leave a comment:


  • jewel87
    replied to parent and child processes
    Thank you very much for your answer, Arul.
    Actually, the wanted output I gave in the beginning, is what the task set by the teacher required. Would this code be the right answer or I can improve it somehow to ensure best marks? What do you think??

    P.S. Here is what the rest task is saying:

    Write a program that uses fork() to create two processes.
    In the child process, do the following:
    • print...
    See more | Go to post

    Leave a comment:


  • jewel87
    started a topic parent and child processes

    parent and child processes

    Hi everyone!
    I'm writing some code in C under UNIX, which should give some output like this:
    PARENT: pid = 10063
    CHILD: my pid = 10064
    CHILD: my parent's pid = 10063
    CHILD: Sleeping...
    PARENT: my child's pid = 10064
    PARENT: Waiting for the child to exit...
    CHILD: Done sleeping...
    PARENT: child is dead.

    The output I am getting looks like this:

    CHILD: my pid...
    See more | Go to post

  • jewel87
    started a topic makefile conditional error, UNIX
    in C

    makefile conditional error, UNIX

    Hi everyone,
    I'm trying to write a makefile with a conditional statement that uses a variable to specify a C compiler which may be cc or gcc.
    I am basically using the example we were given in the notes for this task, but it is giving me error.
    This is the code:

    Code:
    libs_for_gcc = -lgnu
    normal_libs =
    
    objects = myApp.o hello.o here.o bye.o
    myApp : $(objects)
    ...
    See more | Go to post

  • Actually, I was confused by your question at first, but then suddenly i got what you mean! Thank you a lot!!! It's now alright!...
    See more | Go to post

    Leave a comment:


  • here is my makefile:
    Code:
    myApp : hello.o here.o bye.o
            cc -o myApp hello.o here.o bye.o
    
    hello.o : hello.c
            cc -c hello.c
    here.o : here.c
            cc -c here.c
    bye.o : bye.c
            cc -c bye.c
    
    clean :
            rm -f hello.o here.o bye.o
    See more | Go to post

    Leave a comment:


  • jewel87
    started a topic Compiling simple program with several files, UNIX
    in C

    Compiling simple program with several files, UNIX

    Hi everyone!
    I am trying to compile a very simple program on UNIX, which consists of several files, each of them has a function that prints out a string of text.
    Then the file with the main function call each of these functions.
    Here are the codes in the files:

    Code:
    //****** hello.h
    void func_hello();
    
    
    //******hello.c
    #include <stdio.h>
    #include "hello.h"
    ...
    See more | Go to post

  • jewel87
    started a topic How to extract text line by line from TMemo?
    in C

    How to extract text line by line from TMemo?

    Hi everyone,

    I need to check for a substring in each line of a TMemo, how can I get each line separately?
    I'm using this method now:
    Code:
     int found;
            for (int i=1; i<MemoLines; i++)
            {
                    String str = ShoppingBasketMemo->Lines->GetText();
                    found = str.Pos(ProductNameForSearch);
                    if (found!=0)
    ...
    See more | Go to post

  • jewel87
    replied to Incompatible type conversion
    in C
    There is the problem, it is not saying anything about any types at all, just as it is here:
    E2110: Incompatible type conversion...
    See more | Go to post

    Leave a comment:


  • jewel87
    replied to Incompatible type conversion
    in C
    I am using classes, and this function is a member of class. I have some problem with function call, why does it say Incompatible type conversion??...
    See more | Go to post

    Leave a comment:


  • jewel87
    started a topic Incompatible type conversion
    in C

    Incompatible type conversion

    Hello everyone,

    I'm working on a function reading data from file.
    I am getting an error: E2110 Incompatible type conversion
    Here is what i have:

    function in the form:
    Code:
    void __fastcall TForm1::EnterProductFromFileClick(TObject *Sender)
    {
            char ProductName[256]="";
            int ProductID;
            float Weight;
            char WeightCategory[256]="";
    ...
    See more | Go to post

  • ok, guys, thank you all anyways, don't fight, it's ok.
    See more | Go to post

    Leave a comment:


  • Can't make sense of this arrays and pointers assignment

    Hello guys,

    I have a problem again with my lecturer's task she has given, I feel it is wrong at all.
    Here is what she gave us:

    in the Account.h attributes

    Code:
     Transaction **Transactions; // she called this 'declaring an array Transactions'
    but so far this is just a pointer to pointer, isn't it?

    then in Account.cpp :

    Code:
    Account
    ...
    See more | Go to post

  • jewel87
    replied to E2353 Class '.. ' is abstract because of...
    in C
    Yeah, thanks, you made it more clear, but what should i do with the data specific for each derived class? i need to pass to each new object additional arguments depending on the class......
    See more | Go to post

    Leave a comment:


  • Thank you very much for help, i'll try to study copy constructor thing when i get a bit of time.
    i'm using vectors in this case, would

    vector<*Employe e>

    mean that i create a vector of pointers to Employee objects?...
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...