Search:

Type: Posts; User: Acolyte

Search: Search took 0.00 seconds.

  1. Writing a Unix Search Program, some questions

    Hey, for my Systems Programming course this semester, our prof has given us an assignment to create a Unix search program in C. Essentially, you give it a file name, go through each file, compare...
  2. Replies
    1
    Views
    1,354

    Reading Sequential Text Files

    (Back again, yes I know...)

    Anyways, for my current program, the last bit involves saving an inputted structure to a sequential text file, then loading it again later.

    Here's the current save...
  3. Replies
    3
    Views
    1,031

    String Replacement

    Part of my current program involves searching for spaces in a string and replaces them with underscores. Here's the current function:

    void spacereplace()
    {
    int cnt, cnt2;
    for...
  4. Replies
    8
    Views
    1,804

    That's not there anymore, it's been changed to...

    That's not there anymore, it's been changed to actually work.
  5. Replies
    8
    Views
    1,804

    Well, the fflush seems to be working for what I...

    Well, the fflush seems to be working for what I need it to do, and that's to get rid of the newline read in from the menu.

    However, I still can't get it to read in the last section. Here's what...
  6. Replies
    8
    Views
    1,804

    Gah, sorry, those are all stupid proofreading...

    Gah, sorry, those are all stupid proofreading mistakes, stuff I forgot to nuke from prior fixing attempts.

    Salem, I couldn't find anything in the FAQs about fflush-what should I be using?
    ...
  7. Replies
    8
    Views
    1,804

    String Reading Issues

    I'm working on an assignment that takes some inputs for an address book. However, I have problems getting the input to read properly. Here's the section so far:

    char addcontact ()
    {
    auto...
  8. Thread: Using isdigit

    by Acolyte
    Replies
    6
    Views
    2,967

    Ah, that did it Mats. Thanks, I knew it was some...

    Ah, that did it Mats. Thanks, I knew it was some silly little mistake that I just needed a second set of eyes to get.
  9. Thread: Using isdigit

    by Acolyte
    Replies
    6
    Views
    2,967

    Sure. #include #include...

    Sure.


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

    /*int replace (char wordlist[][100], int repnum);*/
  10. Thread: Using isdigit

    by Acolyte
    Replies
    6
    Views
    2,967

    Using isdigit

    Part of a program I'm working involves searching through an array of char and, if it finds a digit, converting it to int. Here's the section of the program doing that:

    for (cnt = 0; cnt < wordcnt;...
  11. Replies
    5
    Views
    1,457

    What I was trying to do there is have it tokenize...

    What I was trying to do there is have it tokenize until it reaches a '0' in the string (The string will consist only of alphanumeric characters).
  12. Replies
    5
    Views
    1,457

    Ok, new problem. The old one was just me being...

    Ok, new problem. The old one was just me being stupid and unobservant.


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

    int main ()
    {

    char wordlist[100][100];
  13. Replies
    5
    Views
    1,457

    Arrays of Words

    I'm trying to work on a program that takes a string as an input, parses it into words according to spaces and newline characters, puts each word in its' own space into a char array, then prints the...
  14. Replies
    7
    Views
    2,032

    EDIT: NVM, found the problem.

    EDIT: NVM, found the problem.
  15. Replies
    7
    Views
    2,032

    Damn-that's something I hadn't considered. How...

    Damn-that's something I hadn't considered. How would I go about dealing with multiple-digit numbers, then?
  16. Replies
    7
    Views
    2,032

    Changing it to i = atoi(&input[cnt2]); removed...

    Changing it to
    i = atoi(&input[cnt2]); removed the error, but it's still not working. Here's the whole section:


    for (cnt2 = 0; cnt2 < 30; cnt2++)
    {
    ...
  17. Replies
    7
    Views
    2,032

    atio-What am I doing wrong?

    Part of my current assignment requires reading input from a file (Using I/O redirection) into a string of char, then parsing it, converting the numbers to int and saving that to an array of int....
  18. Replies
    8
    Views
    5,688

    So, how would I convert '-' and '1' to an...

    So, how would I convert '-' and '1' to an integer? Or, rather should I change it to just

    while ((c = getchar()) != '-'), since the only reason a '-' would occur would be to denote the '-1'?
  19. Replies
    8
    Views
    5,688

    Ok, here's what I've got. As per my assignment...

    Ok, here's what I've got. As per my assignment instructions, it actually just uses I/O redirection. However, I'm having some errors:

    #include <stdio.h>
    char input [30];
    int stack [30];
    char c;...
  20. Replies
    8
    Views
    5,688

    How should I go about having it so it picks up...

    How should I go about having it so it picks up where it left off after sorting each line? I was thinking something along the lines of this:

    While (!= EOF)
    fgets (numbers, converts to int, puts it...
  21. Replies
    8
    Views
    5,688

    Reading Input from a file, line-by-line

    For an assignment in my C course, I need to write a program that reads lines of numbers from a file, sorts them, writes the output to a file then reads the next line and continues, until a -1 is...
Results 1 to 21 of 22