Search:

Type: Posts; User: eidgeare

Search: Search took 0.02 seconds.

  1. Checking for repeated data: variable against file

    I'm making a phonebook and I was trying to implement a system for not letting have repeated names on it.

    After a long time trying to debug it, I found the reason why it wasnt working.

    ...
  2. Thread: Tools

    by eidgeare
    Replies
    11
    Views
    2,455

    Well, first of all: Welcome. As for the...

    Well, first of all:

    Welcome.

    As for the compiler, if you're using windows than I'd probably recommend an IDE (C-Dev++) as it is simple to use and easy to get to know it.

    On linux either use...
  3. Replies
    5
    Views
    17,885

    Actually I did try, but using "". My bad. ...

    Actually I did try, but using "". My bad.

    Sorry for making you lose your time and thank you,

    Hugo Ribeira
  4. Replies
    5
    Views
    17,885

    Whats the int value of '\n'?

    I've tryed to google it, but did manage to find it.

    I'm trying to read 3 diferent variables from a file that looks like this:

    Name1
    1231321321
    12/12/2009

    Name2
    1232132132
  5. Replies
    25
    Views
    2,736

    So the file wasnt empty earlier then. fflush...

    So the file wasnt empty earlier then.

    fflush was what made it work, although it should have worked before, because the file was already written to disk.

    what about the FILE *pointer? does it...
  6. Replies
    25
    Views
    2,736

    Thanks, I'll do my homework now on the buffer. :)...

    Thanks, I'll do my homework now on the buffer. :)

    Btw Pointers, if I understand them correctly, they store the path to the place where a variable is. Being it in memory or in the harddrive is it...
  7. Replies
    25
    Views
    2,736

    It works now. Thank you. Can we just move on...

    It works now. Thank you.

    Can we just move on to the understanding part, because I wanna try to understand what just went in here.

    fflush() and fseek(file_pointer,int x?,SEEK_SET ) do the same...
  8. Replies
    25
    Views
    2,736

    Allright, here we go: Opening the file is...

    Allright, here we go:

    Opening the file is successfull(please correct the spelling of this word for me, I'm portuguese).
    It goes in the IF STATEMENT and printf success.

    The output of quzah's...
  9. Replies
    25
    Views
    2,736

    fseek outputs 0; after your edit, I flushed...

    fseek outputs 0;

    after your edit, I flushed the stream by:


    fseek(database,0,SEEK_SET)
    printf("%d", fseek(database,0,SEEK_END))

    but still fseek seek_end outputs 0.
  10. Replies
    25
    Views
    2,736

    It isnt empty, the program writes variables to...

    It isnt empty, the program writes variables to it. It's actually a pretty big file now, because everytime I run the app, it writes 3 variables to it [name, bday and cell_number].

    database.txt:
    ...
  11. Replies
    25
    Views
    2,736

    Yes, I did write it before the last while, also...

    Yes, I did write it before the last while, also it is skipping the loop because printf("whatever") doesn't print anything.
  12. Replies
    25
    Views
    2,736

    Added the line but no change. Is it possible...

    Added the line but no change.

    Is it possible my EOF is in the beggining of the file and that's why it is skipping the loop?
  13. Replies
    25
    Views
    2,736

    I've oppened the file in "a+" mode, because I...

    I've oppened the file in "a+" mode, because I want the program to create a new file, if there is no database file. (Imagine I want to take my app to other pc, if there is no database file, then it...
  14. Replies
    25
    Views
    2,736

    Noobie working on file I/O. fgetc problem

    int criar_contacto()
    {
    char name[33], bday[11];
    int cell_phone, cop, x;
    char opcao;
    FILE *database;

    //Input Data Section:
    do{
  15. Replies
    3
    Views
    4,536

    It works now, but I don't understand why. what...

    It works now, but I don't understand why.

    what goes in that argument is name[], right? which acts as a pointer, so shouldn't I call the argument type a pointer as well?

    EDIT: Understood, thank...
  16. Replies
    3
    Views
    4,536

    integer to pointer without cast[Solved]

    int criar_contacto()
    {
    char name[33], bday[11];
    int cell_phone;

    printf("Introduza o Nome do contacto:\n");

    get_string(name, 33);

    printf("%s", name); // This is just for test purpose
  17. Replies
    2
    Views
    1,786

    Thank you, just realised how stupid I was

    Thank you, just realised how stupid I was
  18. Replies
    2
    Views
    1,786

    Not able to compare a char variable [SOLVED]

    First of all, hello everyone.

    I'm pretty much a virgin, here and in programming.

    So the problem is:


    do
    {
    printf("Introduza o nome do contacto(max. 32 caracteres):\n");
Results 1 to 18 of 18