Search:

Type: Posts; User: crash88

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Thread: lseek error

    by crash88
    Replies
    4
    Views
    4,602

    no, I was sure the file wasn't empty and tried it...

    no, I was sure the file wasn't empty and tried it on a couple files. the command was
    programname /etc/passwd file.txt
    programname program.c file.txt
    Both have read permissions for the user.
  2. Thread: lseek error

    by crash88
    Replies
    4
    Views
    4,602

    lseek error

    I'm just learning the unix system calls and have used lseek a few times and never had a problem with it. It's a pretty straight forward system call but this one is getting me. I'm getting the error...
  3. Replies
    7
    Views
    2,693

    too bad it wasn't stdin. the output was this when...

    too bad it wasn't stdin. the output was this when I tried writing each character to the screen
    crash@venus::~/programs/usp/ch2$ ./frontdesk file.txt


    1 getoccupier
    2 freeroom
    3 addguest
    4...
  4. Replies
    7
    Views
    2,693

    I changed the char to an int and nothing changed....

    I changed the char to an int and nothing changed. Thanks for the advice.
  5. Replies
    7
    Views
    2,693

    of course it occured to me. I explained that...

    of course it occured to me. I explained that withought the use of clearstdin I get the output
    Enter last name: Enter first name:
    The both go on the same line so stdin obviously needs a douche.
  6. Replies
    7
    Views
    2,693

    I'm missing something obvious

    I'm trying to complete an excercise to learn unix system calls and one of the functions in the program was giving me only partial output. So I wrote a test program that is almost identical to the one...
  7. Thread: flushing stdin

    by crash88
    Replies
    2
    Views
    2,411

    thanks.

    thanks.
  8. Thread: flushing stdin

    by crash88
    Replies
    2
    Views
    1,397

    flushing stdin

    I prompt for input and the scanf function is skipped over because the stdin buffer contains data. How can I flush this beforehand? Everywhere I look tells me it's system dependent and I'm on linux...
  9. Replies
    4
    Views
    3,384

    thanks

    thanks
  10. Replies
    4
    Views
    3,384

    sorry, I posted this the lazy way. the loop is...

    sorry, I posted this the lazy way. the loop is needed in the program this is for (this is just the part that's not working. In the actual program, each case statement has a function.
  11. Replies
    4
    Views
    3,384

    switch statement

    what is wrong with the following snippet? are intergers not allowed in switch statements?


    #include <stdio.h>

    int
    main()
    {
    int i;
  12. Thread: flushing stdin

    by crash88
    Replies
    2
    Views
    2,411

    flushing stdin

    on linux, would it be safe to open /dev/null as a regular file for write only to flush stdin? or is there another way to do it?
  13. Thread: flushing stdin

    by crash88
    Replies
    1
    Views
    9,080

    flushing stdin

    In the faq, there is a section saying that it is unsafe to fflush(stdin) (it doesn't work correctly anyway). I'm having a problem with a function and an infinate loop with switch statement where the...
  14. Replies
    2
    Views
    1,627

    Thanks. I still get confused with pointers.

    Thanks. I still get confused with pointers.
  15. Replies
    11
    Views
    1,612

    Your code is hard to read. It's pretty...

    Your code is hard to read. It's pretty conventional to use tabs for things like if statements, loops, etc:
    example:


    for (i = 0; i < 10; ++i) {
    scanf("%s", str);
    }

    You'd probably have...
  16. Replies
    1
    Views
    1,240

    problem with variable passed as reference

    This is completely confusing me. I have a call to a function:


    case '5': if ((findfree((int)&roomnum)) < 0)
    printf("No available rooms\n");
    ...
  17. Replies
    2
    Views
    1,627

    unexpected output

    I'm having some trouble with this. It seems basic enough but I keep getting a large integer in the range of 1000-2000 instead of what it looks to me like should be 1-10 or return a negative number.
    ...
  18. Replies
    5
    Views
    1,073

    I'm passing it as a value intentionally since the...

    I'm passing it as a value intentionally since the value will be changed in the createfile function. All it needed was a typecast. For some odd reason I cannot pass a value of that type without the...
  19. Replies
    5
    Views
    1,073

    ssize_t is a type in unistd.h. It's used to count...

    ssize_t is a type in unistd.h. It's used to count the number of chars written or read to or from a file. I'm guessing it's pretty standard since I'm learning this out of a unix system programming...
  20. Replies
    5
    Views
    1,073

    type problem on compilation

    I keep getting the error:
    openfile.c: In function `openfile':
    openfile.c:27: warning: passing arg 1 of `createfile' makes integer from pointer without a cast
    I don't fully understand the meaning...
  21. is there a function that reads a certain number of chars on command line?

    Is there such a function or does one have to write it himself using getchar() and appending the chars into a buffer in a loop?
  22. Replies
    3
    Views
    7,047

    sorry I wasn't clear in my initial post. I'm...

    sorry I wasn't clear in my initial post. I'm reading from the command line.
  23. Replies
    3
    Views
    7,047

    getline function for ansi c

    Is there an ansi c function equivelant to the c++ getline function? The only way I can think of to do this is to use the read system call (on linux), but I wouldn't know what to do if I were trying...
  24. Replies
    3
    Views
    7,602

    is bool.h part of ansi c?

    If they aren't I know it's possible to make a bool type using define macros. The reason I'm wondering is because I'm thinking about programming with MFC.
  25. where are the function definitions to the ansi c library on linux?

    Where are functions in ANSI C such as strlen() or getchar() defined on a linux system? You are able to look through the header files but there's no definitions. Sometimes you see a declaration. I...
Results 1 to 25 of 31
Page 1 of 2 1 2