Search:

Type: Posts; User: bungkai

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    5
    Views
    2,545

    I want it to just print out a file, the other...

    I want it to just print out a file, the other things is excess I guess I should have taken out. But the key thing is that it works without nanosleep. I want it to sleep for a random time and pick up...
  2. Replies
    5
    Views
    2,545

    nanosleep messing things up.

    As the title says, it messes things up. My program is supposed to read in char by char, which works fine without nanosleep, when I add it in, messes things up. Yes I MUST use nanosleep which is why...
  3. Replies
    10
    Views
    1,138

    I actually tried that, well, I got weird results....

    I actually tried that, well, I got weird results. I'm making a problem that keeps count of the word with the highest frequency. Say, the finding part is within

    void *find_t(void *arg)


    Assume...
  4. Replies
    10
    Views
    1,138

    So, concurrent if I have multiple cpus and no if...

    So, concurrent if I have multiple cpus and no if I don't for the case of a second for loop. What if I have the thread joining at the first loop after I created them?
  5. Replies
    10
    Views
    1,138

    Ok, that worked. though I'm a little confused as...

    Ok, that worked. though I'm a little confused as to how pthread_join works.

    I have another question. Does my program above run sequentially or concurrently?
  6. Replies
    10
    Views
    1,138

    Thread problem?

    So I'm having trouble with threads. What I'm trying to do is create an argc amount of threads that runs some sort of task. In this case, at least open a file..

    When I use printf before the...
  7. Replies
    1
    Views
    6,000

    Passing structures through pipes

    Say, I have a parent process and a few child processes, and a structure as so:

    typedef struct {
    char a[101];
    int b;
    } CS;


    And I want to pass this through a pipe.
  8. Replies
    3
    Views
    3,972

    Thank you, and the processes to argcs is for a...

    Thank you, and the processes to argcs is for a bigger purpose, this was just a test. :)
  9. Replies
    3
    Views
    3,972

    Multiple processes running concurrently in c

    Is this how you do it?


    int main(int argc, char *argv[])
    {
    int i = 0;
    for(i=0;i<argc;i++)
    {
    if(fork() == 0)
    {
  10. Replies
    6
    Views
    1,357

    But if I wanted to compare a non structure string...

    But if I wanted to compare a non structure string to a structure one? strcpy(tempword,words[0]->word)? How would my tempword be declared?



    char tempWord[101]; Would this suffice?
  11. Replies
    6
    Views
    1,357

    Sorry, I forgot to include that strcmp gives me...

    Sorry, I forgot to include that strcmp gives me problems too
  12. Replies
    6
    Views
    1,357

    Comparing strings

    So, I've been struggling for a while now figuring out how to properly compare strings. I have


    typedef struct {
    char word[101];
    int freq;
    } WordArray;

    static WordArray...
  13. Replies
    7
    Views
    1,525

    Whats wrong with my sorting algorithm?

    I'm just trying to get a simple sorting by swapping algorithm to work on an existing unsorted array..


    int a, b;
    for (a =...
  14. Replies
    16
    Views
    1,985

    AndrewHunter, it worked, thank you for your...

    AndrewHunter, it worked, thank you for your help.

    quzah, I will keep in mind about all the advice that have been given and will start cleaning up my code. I understand the reasoning and all.
  15. Replies
    16
    Views
    1,985

    Well, it works for the first, third, fifth and so...

    Well, it works for the first, third, fifth and so on times. However, the second, fourth, and 6th go a little loopy and I don't really know what's going on :S. Sometimes I'm getting the same problem...
  16. Replies
    16
    Views
    1,985

    AndrewHunter, I added this: ...

    AndrewHunter, I added this:


    while((scanf("%s", &temp)) != EOF)
    {
    if (temp != '\n')
    {
    c = temp;
    }
  17. Replies
    16
    Views
    1,985

    What I'm trying to say is that with fgets(), my...

    What I'm trying to say is that with fgets(), my output becomes:

    name: age:

    instead of:

    name:
    age:

    It also completely ignores taking a line of text and skips to the next scanf.
  18. Replies
    16
    Views
    1,985

    No, this is what I used to have in my program. ...

    No, this is what I used to have in my program.



    printf("name: ");
    scanf("%s", &patients[count]->name);
    printf("age: ");
    scanf("%d",...
  19. Replies
    16
    Views
    1,985

    Well, as I said above, I've already tried fgets()...

    Well, as I said above, I've already tried fgets() but it does not prompt for an input. I've also tried delimiters and other functions to get what I wanted to read either just one or two strings but...
  20. Replies
    16
    Views
    1,985

    Flexibility with reading one or two strings?

    While programming I bumped into a block that required me to scan in a name that can take a first name OR a full name. Before this I was using a scanf to read a string, and obviously it does not work...
  21. Record *temp[30]; int k; count...

    Record *temp[30];
    int k;
    count = 0;
    for (k=0;k<count;k++)
    {
    patients[k]->name = temp[k]->name;
    patients[k]->age = temp[k]->age;
    ...
  22. Thanks, it worked! How would I go about clearing...

    Thanks, it worked! How would I go about clearing the variables then? Since I was more or less doing the same thing.
  23. Problem with array of pointers to structures and such

    I have a little problem.

    In the following problem I am trying to display an array of pointers in a separate function. The commented section displays the "name" variable correctly, however, the...
  24. Thread: scanf problems

    by bungkai
    Replies
    17
    Views
    2,178

    Same result with the == 1

    Same result with the == 1
  25. Thread: scanf problems

    by bungkai
    Replies
    17
    Views
    2,178

    I'd need to try it without strtol. ssharish,...

    I'd need to try it without strtol.

    ssharish, but if I were to enter less than 20 inputs, wouldn't it loop until I have 20 inputs?
Results 1 to 25 of 31
Page 1 of 2 1 2