Search:

Type: Posts; User: november1992

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Replies
    3
    Views
    1,421

    Checking if a file exists

    If my program asks a user to input a file name and then check if that file exists, would I have to use an if statement to see if that file is able to open?


    Something like this:


    if(FILE_1 =...
  2. Replies
    11
    Views
    7,405

    I came up with the idea after I posted the...

    I came up with the idea after I posted the original code. But i realized I included parts of the code that skipped into the if statement. It works now.


    I write void main because that's what my...
  3. Replies
    11
    Views
    7,405

    Cool, it works now! Thanks. Although, I'm...

    Cool, it works now! Thanks.
    Although, I'm curious why my idea didn't work. I used strcpy to put argv[2] into a temp and then use isdigit on the first element. If isdigit returned 0, it printed...
  4. Replies
    11
    Views
    7,405

    Could I use strlen to figure out how long the...

    Could I use strlen to figure out how long the input is and then use isdigit to check the first element?
  5. Replies
    11
    Views
    7,405

    #include #include ...

    #include <stdio.h>
    #include <stdlib.h>

    #define MAXCHAR 256



    void main( int argc, char *argv[])
    {
    int fibonacci(int n);
  6. Replies
    11
    Views
    7,405

    Using isdigit and atoi

    My program calculates the first n numbers of the fibonacci series. For error checking, I've prevented the program from trying to calculate a negative number, but I'm having trouble with character...
  7. Replies
    7
    Views
    1,097

    That would be easier, but it was supposed to be...

    That would be easier, but it was supposed to be singly linked not doubly.
  8. Replies
    7
    Views
    1,097

    well it didn't work out the way i had hoped. I'll...

    well it didn't work out the way i had hoped. I'll just ask my professor.
  9. Replies
    7
    Views
    1,097

    Linked Lists

    I was wondering how to find the previous node in a singly, circular linked list.

    In this picture I have 4 nodes.
    http://i.imgur.com/hlvzT.png

    If I wanted to get rid of the node Sarah, I would...
  10. Replies
    25
    Views
    12,574

    I'm not sure why this isn't working. It...

    I'm not sure why this isn't working. It increments i by 1 until it finds the element that contains the '.' character. Then it adds '_out' to the location before '.'. I do get warnings before it...
  11. Replies
    25
    Views
    12,574

    I was thinking about using a for loop to compare...

    I was thinking about using a for loop to compare the character '.' with the contents of a char array holding the name of the file. I would use the strcat function to add the _out.txt part to...
  12. Replies
    25
    Views
    12,574

    I have a question, how can I make an output file...

    I have a question, how can I make an output file that takes the name of the input file and replaces the .txt extension with "_out.txt"?

    For example, an input file with the name “test.txt” would...
  13. Replies
    25
    Views
    12,574

    I remember my TA telling me this too. I'm...

    I remember my TA telling me this too. I'm forgetful :p. thanks it scans now.
  14. Replies
    25
    Views
    12,574

    I tried using temporary variables, but now my...

    I tried using temporary variables, but now my program crashes.


    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>


    #define MAXSIZE 256
  15. Replies
    25
    Views
    12,574

    I asked my TA whether to use 3 or EOF and he just...

    I asked my TA whether to use 3 or EOF and he just told me to use EOF. But I'll just use 3 because it makes more sense to.

    So here is my code so far. At the fscanf part it reads the contents of the...
  16. Replies
    25
    Views
    12,574

    My teacher says that he will test our program...

    My teacher says that he will test our program with a text file. He never said how many items there would be in there, he only said it would be different for everyone.

    I can't use any functions we...
  17. Replies
    25
    Views
    12,574

    What if I don't know the number of items that...

    What if I don't know the number of items that need to be scanned? Shouldn't I use EOF then?
  18. Replies
    25
    Views
    12,574

    Using fscanf to read text from a file.

    void main(void){


    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>


    #define MAXSIZE 256
  19. Replies
    4
    Views
    1,120

    Question about pointers.

    I'm having a hard time using pointers because I don't understand them that well. When is it correct to use the * and & operator and what do they do?
  20. Replies
    1
    Views
    1,035

    Something is wrong with my program

    I wrote two programs to switch the order of an array. I wrote them in the same way, but only one of them works correctly. Could someone tell me what is wrong?

    Oh I just figured out the problem :p...
  21. Replies
    11
    Views
    2,503

    You said string2 is converted to a pointer to its...

    You said string2 is converted to a pointer to its first element, so what is that value? And how does it find the position by subtracting from find_c?



    i = find_c - string2;


    printf("The...
  22. Replies
    11
    Views
    2,503

    Program to demonstrate strchr function

    My professor wrote this program below. I was wondering why the find_c variable always changes when I run the program. Also, I'm confused about this line

    i = find_c - string2;

    "i" is the...
  23. I'm just curious, what is wrong with using void...

    I'm just curious, what is wrong with using void main()? He never really explained the point of returning values.
  24. Okay, I tested it now and it works. Thank you for...

    Okay, I tested it now and it works. Thank you for the help.
  25. Oh, I didn't think about that. So is this right?...

    Oh, I didn't think about that. So is this right?

    #define NUM_ELEMENTS 7

    int find_smallest (int x[], int y)
    {
    int i,small;
Results 1 to 25 of 62
Page 1 of 3 1 2 3