Search:

Type: Posts; User: TitoMB345

Search: Search took 0.01 seconds.

  1. Thread: Time elapsed

    by TitoMB345
    Replies
    13
    Views
    2,504

    Oh, and I'm running Windows, but the computer it...

    Oh, and I'm running Windows, but the computer it has to compile on is SunOS I believe.. might be Linux, not 100% sure.
  2. Thread: Time elapsed

    by TitoMB345
    Replies
    13
    Views
    2,504

    Well, I have it take the start time before the...

    Well, I have it take the start time before the getInput() function runs, and getInput() waits for input from the keyboard, so I tried waiting a couple of seconds, and still, nothing came up. I'm not...
  3. Thread: Time elapsed

    by TitoMB345
    Replies
    13
    Views
    2,504

    Okay, so my quick exploration into clock() sent...

    Okay, so my quick exploration into clock() sent me on this path:


    clock_t start, end;

    ...

    int main() {
    int numrows = 0, numcols = 0;
  4. Thread: Time elapsed

    by TitoMB345
    Replies
    13
    Views
    2,504

    Ahha, I knew it was something simple.. Now, is...

    Ahha, I knew it was something simple..

    Now, is there a way to have it go into milliseconds or anything lower than seconds? The function runs so fast it usually just says 0...
  5. Thread: Time elapsed

    by TitoMB345
    Replies
    13
    Views
    2,504

    Time elapsed

    Hey guys, I was wondering if anyone could help me with a quick question.
    I need to find a way to print the time it took for a program to run in seconds. I don't have much experience with time, but...
  6. Replies
    14
    Views
    2,210

    So, reading through my C text, it seems somehow I...

    So, reading through my C text, it seems somehow I will have to use fseek(). I think my original approach to the problem was incorrect. I am going to start over and try another way.
  7. Replies
    14
    Views
    2,210

    Yeah, I still havent been able to find a way to...

    Yeah, I still havent been able to find a way to do this. It seems nearly impossible without the ability to store all the data in the program, it would be easy if this were possible. But I am not...
  8. Replies
    14
    Views
    2,210

    Alphabetizing a file?

    Another quick thing I need some assistance with is alphabetizing a file created from the program. So, the program will create a file like:

    Namath Joe
    Lugo Julio
    Favre Brett
    Jordan Michael
    ...
  9. Replies
    6
    Views
    976

    Okay, one more quick question now too: How can...

    Okay, one more quick question now too:

    How can I have the program wipe the file first before writing to it?


    int main() {
    FILE *list, *output;
    char first[MAX], last[MAX],...
  10. Replies
    6
    Views
    976

    Ah, nevermind, I had a stupid error.. in my FILE...

    Ah, nevermind, I had a stupid error.. in my FILE definition for the output file I forgot the * before it. So when I did something like


    output = fopen(filename, "w");

    Where filename was equal...
  11. Replies
    6
    Views
    976

    Dynamic File writing?

    Hey guys, I've got a quick, and seemingly simple, question for you all. How would I write a function that would dynamically write output to a file? For example, say the program is to take 2 words...
  12. Replies
    3
    Views
    1,028

    Ahha, that did it. I could have sworn I had the...

    Ahha, that did it. I could have sworn I had the code to alloc the memory in there before.. must have lost it in my many attempts to fix the code after the first run through. Thanks again!
  13. Replies
    3
    Views
    1,028

    No ideas?

    No ideas?
  14. Replies
    3
    Views
    1,028

    Queue trouble!

    Hey guys,

    I am in the midsts of writing code that involves managing two queues of names, and having the ability to call one name from the queue, and then deleting it. For some reason, I can't...
  15. Replies
    8
    Views
    1,755

    Thats what I tried now, but the conclusion I've...

    Thats what I tried now, but the conclusion I've come to is that the sscanf and fscanf functions in the library on our servers are just incorrect. There is no other explanation.
  16. Replies
    8
    Views
    1,755

    Hmm, well I put that in directly and it gave me a...

    Hmm, well I put that in directly and it gave me a seg fault, and then I noticed there was no 's' after the first [^,] thing, so I added it, and the seg fault went away, but the results were still not...
  17. Replies
    8
    Views
    1,755

    fscanf troubles!

    Hey guys,

    I have run into a problem using fscanf to properly read a file.


    struct menu {
    int calories, price;
    char name[MAXNAME], type[MAXNAME];
    } dish[MAXDISH];
  18. Replies
    2
    Views
    1,001

    Hey, thanks for the help! It's funny though,...

    Hey, thanks for the help! It's funny though, because we figured out what we had to do about 2 minutes before you posted it! I really appreciate the help though.
  19. Replies
    2
    Views
    1,001

    Array of Strings help

    Hey guys, I am stuck with another C programming problem that I can't seem to get around.

    The problem I am having is trying to read a file of words, like a story, into an array of strings. What...
  20. Replies
    13
    Views
    1,596

    Hey guys, thanks again for the help. You are...

    Hey guys, thanks again for the help.

    You are right, the assignment says to assume there would be no more than 1000 ints entered. So if they enter 1000 ints, the character array would overflow...
  21. Replies
    13
    Views
    1,596

    Actually, I ended up using Recursion to fix it! ...

    Actually, I ended up using Recursion to fix it!



    void sepArrays(char input[], int array[], int *pos) {
    long num = 0;
    char *p;

    num = strtol(input, &p, 10);
    if (num != -2) {
  22. Replies
    13
    Views
    1,596

    Okay, so my latest thought would be somehow using...

    Okay, so my latest thought would be somehow using recursion to keep looking for ints until the input is over... hmm.
  23. Replies
    13
    Views
    1,596

    Hmm, okay, so I have strtol() convert the first...

    Hmm, okay, so I have strtol() convert the first appearance of an integer into a long... how do I go on from there? How do I tell the program to start looking again passed the integer? The pointer I...
  24. Replies
    13
    Views
    1,596

    Yes, it is always a single line of numbers input...

    Yes, it is always a single line of numbers input by the user.

    I just need the line to be separated into an array of ints with each index at one. I will try what Salem mentioned, thanks!
  25. Replies
    13
    Views
    1,596

    Ideas Welcome!

    Hey guys, first time poster!

    I had a quick question for the masses about a program I am writing: I need to take the input from the user at the keyboard that contains all integers, and then store...
Results 1 to 25 of 25