Search:

Type: Posts; User: mesmer

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    1
    Views
    13,512

    For Loop inside While Loop

    This simple loop construct is confusing me. I'm not seeing why the output is what it is. When I look at the code it seems like this should print one set of statements with x going from 0 to 4. Like...
  2. Replies
    4
    Views
    1,935

    I have a file with a bunch of records in it. From...

    I have a file with a bunch of records in it. From the file I need to fill an array of structures. I have to do this dynamically.
  3. Replies
    4
    Views
    1,935

    Filling Array Of Structures From A File

    I'm having a hard time discovering how to fill an array of structures from a file. This is what I'm trying to do.

    I am going to open a file from the command line. In the file are a bunch of...
  4. Thread: fgets

    by mesmer
    Replies
    1
    Views
    1,755

    fgets

    I need to read a bunch of data. Some of it I know will not be in the format that I need. I know that fgets will read a file steam and pull in everything that is there until EOF and dump it in an...
  5. Replies
    4
    Views
    1,451

    Very frustrated and tired of asking for help

    This board has been very helpful to me and I really appreciate it. However, I'm stuck on a project and reading the book, asking on irc, and forums is not getting me any closer to seeing what I'm...
  6. Replies
    7
    Views
    3,054

    Wow, thx for the help.I give that a shot

    Wow, thx for the help.I give that a shot
  7. Replies
    7
    Views
    3,054

    I guess that I'm not sure where to call the...

    I guess that I'm not sure where to call the macro: Here is the relevant code:


    printf("Enter File Name: ");
    scanf("%s",fileName);
    printf("\n\n");

    sp =...
  8. Replies
    7
    Views
    3,054

    That code works, I guess that my problem is that...

    That code works, I guess that my problem is that while the buffer gets flushed it stops reading from the buffer. I need to keep reading from the buffer until EOF
  9. Replies
    7
    Views
    3,054

    Discard wrong data from stream

    I'm not understanding how to discard unwanted data in a file stream. For example I want to read in a list of doubles and only doubles from a file, if a non double is in the stream, some text for...
  10. Replies
    11
    Views
    1,537

    I thought that the for loop in my code is...

    I thought that the for loop in my code is incrementing or indexing though the data array
  11. Replies
    11
    Views
    1,537

    Ok, this is still not working. I've tried...

    Ok, this is still not working. I've tried everything I can think of but still it's not working as it should. If I run the code I can print the contents of the file just fine,however, they are not...
  12. Replies
    11
    Views
    1,537

    char fileName[100]; int data[100]; ...

    char fileName[100];
    int data[100];
    FILE* sp;

    sp = fopen(fileName,"r");

    while(k=(fscanf(sp,"%i",data) == 1)){
    printf("%10i\n",*data);
    b += k++ ;
  13. Replies
    11
    Views
    1,537

    Oh boy, I thought that an array's name is a...

    Oh boy, I thought that an array's name is a pointer to the first element in the array and that there is no need to place an ampersand in the fscanf function because of this. What am I not...
  14. Replies
    11
    Views
    1,537

    Reading data from file

    I must be making a simple mistake but I can't seem to find out what I'm doing wrong. Here is my problem: I'm reading data from a file into an array, but the values are only being written into the...
  15. Reading a list of ints from file into an array

    I'm having a little difficulty understanding how to read a file into an array - in this case a file of numbers (ints) into an array. I know how to open a file for reading, but once I have it open...
  16. Replies
    8
    Views
    16,559

    Thx for the responsse Salem,but is there an...

    Thx for the responsse Salem,but is there an easier way to do this? I'm not that advanced in my skills yet.
  17. Replies
    8
    Views
    16,559

    no string type in C?

    Since there is no string type in C how do read in a string? For example:

    I want to prompt the user for the name of a file. Using the name of the file I want to open the file.
    Since I won't know...
  18. Thread: fscanf

    by mesmer
    Replies
    5
    Views
    1,811

    Thanks, I see what's going on now! :)

    Thanks, I see what's going on now! :)
  19. Thread: fscanf

    by mesmer
    Replies
    5
    Views
    1,811

    fscanf

    int main(void){
    FILE* spIn;
    int numIn;
    int ary[5];
    int i;
    spIn = fopen("rut.txt","r");
    for(i=0;i<5;i++){
    while((fscanf(spIn,"%d",&ary[i])) == 1)
    printf("%d\n",ary[i]);
    }
  20. Thread: File input

    by mesmer
    Replies
    1
    Views
    878

    File input

    when I write a program that reads a file in to the stream where do I place the file?
    Note: I'm using Ubuntu Linux



    int main(void){
    FILE* spIn;
    int numIn;
    spIn = fopen("rut.txt","r");...
  21. Replies
    9
    Views
    3,593

    The scanf function returns the number of...

    The scanf function returns the number of characters it read correctly. So what you are doing there is setting i to 2 if scanf reads in two characters correctly.
  22. Thread: From C to Java

    by mesmer
    Replies
    26
    Views
    3,437

    Good quality responses,much appreciated:) So it...

    Good quality responses,much appreciated:) So it seems I need to start checking out the Java libraries:cool:
  23. Thread: From C to Java

    by mesmer
    Replies
    26
    Views
    3,437

    From C to Java

    Hey,

    I'm studying C but my next language will be Java. I'm wondering - other than flow of control and data structures like arrays and pointers - how much of what I'm learning will carry over to...
  24. Thread: A real program

    by mesmer
    Replies
    4
    Views
    1,078

    Ok, I've seen make files in my IDE. Netbeans...

    Ok, I've seen make files in my IDE. Netbeans requires you to make a project for your code- in this project are several files-.c,make and a few others
  25. Thread: A real program

    by mesmer
    Replies
    4
    Views
    1,078

    A real program

    I have a question about how "real" programs are created. I'm trying to understand C so i went to sourceforge and download a MUD (multi user dungeon) written in C.
    When I looked in the .zip I noticed...
Results 1 to 25 of 43
Page 1 of 2 1 2