Search:

Type: Posts; User: movl0x1

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Replies
    2
    Views
    1,366

    thanks vart :)

    thanks vart :)
  2. Replies
    6
    Views
    6,119

    Thanks guys. But what I did was do a stat() on...

    Thanks guys. But what I did was do a stat() on the first file (the one I want to copy) to
    get its permissions (st_mode). Then I did an fopen() on the 2nd file (the one I want to create
    and copy...
  3. Replies
    5
    Views
    1,505

    thanks laserlight. I think I got it...

    thanks laserlight.


    I think I got it (maybe). :)
  4. Replies
    2
    Views
    1,366

    question about declaring function extern

    Hi. I see people declare functions as 'extern' in header (.h) files.
    Is this what I should be doing?

    someheader.h


    /* someheader.h */

    extern int func(int a, int b);
  5. Replies
    5
    Views
    1,505

    simple modulus question

    Why is this printing 0 instead of 5? Doesn't the modulus operator
    result in the remainder after a division?




    int main(void)
    {
    int c = 0;
    int remainder = c % 5;
  6. Replies
    3
    Views
    1,468

    Sorry that was a typo: I meant, and in my...

    Sorry that was a typo:

    I meant, and in my program had:

    [code]

    while(!(answer[0] == 'y' && answer[1] == '\n') &&
    !(answer[0] == 'n' && answer[1] == '\n'));
  7. Replies
    3
    Views
    1,468

    a question about fflushing

    Hi. I'm doing this loop:




    char answer[3];

    do {
    printf("Enter (y/n): ");
    fgets(answer, sizeof(answer), stdin);
  8. Replies
    3
    Views
    1,243

    Yeah, I forgot. printf() takes const char*...

    Yeah, I forgot. printf() takes const char* argument for the %s conversion specifier and
    isn't name[0] a const char* ptr (meaning that name[0] ALWAYS points to name array)?
    So I'm casting name[0]...
  9. Replies
    6
    Views
    6,119

    Thanks, but how do I pass the st_mode...

    Thanks, but how do I pass the st_mode (permissions) read by stat() to fopen?

    with open I do:



    open(filename, O_WRONLY | O_CREAT | O_TRUNC, fl.st_mode);


    That creates a new file with...
  10. Replies
    4
    Views
    15,010

    Print out an ascii table with this code and it'll...

    Print out an ascii table with this code and it'll show all the ascii characters and their
    values on stdout



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

    int main(void)
    {
  11. Replies
    3
    Views
    1,243

    simple cast question

    Hello,



    ex1
    -----------------------------------
    char *name[] = "brian";

    printf("Hello %s.\n", name);
  12. Replies
    6
    Views
    6,119

    help with stat() and fopen()

    /* a very simple copy command for unix */
    #include <sys/stat.h>
    #include <sys/types.h>
    #include <errno.h>
    #include <string.h>

    int main(int argc, char *argv[])
    {
    struct stat flinfo; ...
  13. Replies
    5
    Views
    1,216

    Thanks everyone! :)

    Thanks everyone! :)
  14. Replies
    5
    Views
    1,216

    Declaring pointer to variable in struct

    Hello. If I have the following struct




    struct rec {
    char name[20];
    int age;
    }p1;
  15. Replies
    8
    Views
    1,089

    question about casting

    char c = 0xff;
    unsigned int a;

    a = (unsigned int) c;



    How come in the above cast "a" becomes ULONG_MAX or 0xffffffff? Since I am
    casting to unsigned, shouldn't it cast to 0x000000ff, or...
  16. Replies
    7
    Views
    3,836

    Thanks brewbuck. I'll review the loop a little...

    Thanks brewbuck. I'll review the loop a little more and see what's going on, and then
    I'll post the code if I'm still stuck. But yes, I'm using 3 different file pointers. Maybe I'm
    just...
  17. Thread: Learning C

    by movl0x1
    Replies
    12
    Views
    1,761

    Yes. First learn assembly langauge and binary...

    Yes. First learn assembly langauge and binary and hexadecimal. Then you'll know C. :)

    Actually, download GNU C tutorial in pdf or whatever format. It's really a good tutorial.

    Or yeah, Ivor...
  18. Richard Stallman says to write functions like this

    Hi. Richard Stallman recommends to write functions like this:


    int
    function()

    not like this:

    int function();
  19. Replies
    7
    Views
    3,836

    Oh no, I know I can't use the same fp. Thanks...

    Oh no, I know I can't use the same fp.

    Thanks :)

    I think I'll use fgets() :)
  20. Replies
    7
    Views
    3,836

    It's kinda difficult to explain. 1. I'm in a...

    It's kinda difficult to explain.

    1. I'm in a while() loop using fgetc() to read from one stream the name
    of the filename my program will open. Say from this file:

    ----
    filename1\n...
  21. Replies
    7
    Views
    3,836

    help with reading from stream

    Hello fellow C lovers. I have a questions concerning reading from a stream.

    Im reading filenames out of a file like this text file:

    file.txt
    -------------------
    filename1\n
    filename2\n...
  22. Replies
    6
    Views
    9,168

    what's difference between fd and fp?

    Hi. Just wondering what the main differences between a file pointer and a file
    descriptor are.

    I know that a the FILE struct keeps info on the file stream in use. Correct?
    But doesn't a file...
  23. Replies
    9
    Views
    3,513

    Actually, inside the computer this: 1111 1111 ...

    Actually, inside the computer this:

    1111 1111 is -1 and

    1111 1111 is 255 The way a computer differentiates is by
    checking flags in the FLAG register.

    Just because there's...
  24. Replies
    12
    Views
    3,614

    Should I cast return value of malloc?

    Hi. Alot of people say you shouldn't cast the returned pointer from malloc(),
    but just make sure it's not NULL. Isn't malloc supposed to return type void?

    Also, if you don't cast how will the...
  25. Replies
    3
    Views
    2,162

    thank you laserlight. Yes, maybe that was what I...

    thank you laserlight. Yes, maybe that was what I saw.
Results 1 to 25 of 73
Page 1 of 3 1 2 3