Search:

Type: Posts; User: metros

Page 1 of 2 1 2

Search: Search took 0.00 seconds.

  1. Replies
    2
    Views
    1,849

    A program that determines odd numbers

    Hi, I'm not a C programmer. Could someone please code the following request for me in C?

    I have a list of 3 numbers. 3, 6, 7

    I want to scan through this list and count the number of odd...
  2. Replies
    5
    Views
    5,177

    Yes, good idea, I see where you're coming from....

    Yes, good idea, I see where you're coming from. Also I can then refer to the values in the intArray when need be, such as intArray[2]
  3. Replies
    5
    Views
    5,177

    Is this a ridiculous way of doing it? ...

    Is this a ridiculous way of doing it?






    for(i=0; i<3; i++)
    {
  4. Replies
    5
    Views
    5,177

    Thanks for this. Forgetting the conversion...

    Thanks for this.

    Forgetting the conversion for a moment, I'm confused how with a loop each value in the array can be assigned to different variables
  5. Replies
    5
    Views
    5,177

    Extract char array into int vars

    Hi, I want to extract the contents of a char array of size 4 into separate variables of type integer.

    I guess given array[i] I traverse it? But I'm not sure how to populate the variables
  6. Replies
    11
    Views
    1,484

    ultimately what I want to do is take each input...

    ultimately what I want to do is take each input form the command line and put them into their own variable. At the moment I'm playing around with printf to see what is actually contained in the array.
  7. Replies
    11
    Views
    1,484

    I changed it a bit to this......... ...

    I changed it a bit to this.........




    line[i] = getchar();
    while(line[i] != EOF) {
    line[i] = getchar();

    }
  8. Replies
    11
    Views
    1,484

    Ah I see. But why does having c=getchar() before...

    Ah I see. But why does having c=getchar() before print make 1 disappear?
  9. Replies
    11
    Views
    1,484

    Why does this happen?

    Hi. When I run the following program....... and enter in for example 12345

    why does it print out 2345. Where is 1 gone?



    int main ()
    {

    int c;
  10. I want to ignore white spaces

    I want to ignore white spaces
  11. I've written the following rough piece of...

    I've written the following rough piece of code.......




    for(i=0; i<2 && c!=' '; i++)
    {
    if(c != ' ')
    {
    c=getchar();
  12. That makes sense. I'm going to give that a try....

    That makes sense. I'm going to give that a try. Thanks. I'll get back if I'm struggling
  13. Hmmm, it's a bit limited to be honest. Perhaps...

    Hmmm, it's a bit limited to be honest. Perhaps this illustrates how restrictive getchar is
  14. How to treat values on a command line as seperate

    Hi. I want to enter a number of chars on a command line. For example....... a b c 4 6

    How do I take these valuesin and treat them as seperate values?

    I want to use getchar instead of getch or...
  15. Replies
    8
    Views
    1,017

    If you imagine a list textfile1...

    If you imagine a list



    textfile1
    textfile123
    textfile&
    file&
    file2&
  16. Replies
    8
    Views
    1,017

    Hi I tested what you said on the following code,...

    Hi I tested what you said on the following code, however nothing has changed....




    int getline(char s[], int lim)
    {
    int c, i;

    for (i=0; i<lim-1 && (c=getchar())!=EOF &&...
  17. Replies
    8
    Views
    1,017

    Can anyone shed any light on this please? :)

    Can anyone shed any light on this please? :)
  18. Replies
    8
    Views
    1,017

    Sorry! Here's the funciton........ int...

    Sorry! Here's the funciton........



    int getline(char s[], int lim)
    {
    int c, i;

    for (i=0; i<lim-1 && (c=getchar())!=EOF && c!='\n'; ++i)
    s[i] = c;
  19. Replies
    8
    Views
    1,017

    Finding a string of chars that contain 'x'

    Hi, how do I found out if a name ends with '&' or at worse contains '&'. Below is a function that gets an inputted line (or name). Is it possible to add functionality to this function that does what...
  20. Replies
    11
    Views
    4,273

    If anyone could point me in the direction of...

    If anyone could point me in the direction of simple examples of how to accept input from either the command line or other files I'd appreciate it, thanks.
  21. Replies
    11
    Views
    4,273

    Final question on this........ So file1...

    Final question on this........


    So file1 needs to be set up (ie coded with input parameters or whatever) to take in the output?
  22. Replies
    11
    Views
    4,273

    Yep will do, thanks

    Yep will do, thanks
  23. Replies
    11
    Views
    4,273

    Thanks for that information. If I wanted to...

    Thanks for that information.

    If I wanted to use the following command....

    ls -Fa | file1 (where file1 is an exe)

    what should happen? This is off topic, sorry about that
  24. Replies
    11
    Views
    4,273

    Thanks for the reply. I just realized that...

    Thanks for the reply. I just realized that 'redirecting' is possibly the wrong word to use for the | symbol. Anyway I 'd like to stick to using '|' . Any advice would be helpful, thanks ;)
  25. Replies
    11
    Views
    4,273

    redirecting - 'permission denied'

    Hi, I want to redirect the output of the 'ls' command into a file. For example "ls -Fa | ./newfile.text"
    However I am getting the 'permission denied' error. Am I going about this the correct way?
Results 1 to 25 of 31
Page 1 of 2 1 2