show the content of a .dat file in a dos program

This is a discussion on show the content of a .dat file in a dos program within the C Programming forums, part of the General Programming Boards category; Hi, I have some questions concerning files (in Dos windows). My file is REGLECO.DAT Here a part of it's content ...

  1. #1
    Registered User
    Join Date
    Mar 2007
    Posts
    42

    show the content of a .dat file in a dos program

    Hi,

    I have some questions concerning files (in Dos windows). My file is REGLECO.DAT
    Here a part of it's content
    Code:
    sIdentif   fRegle    sType   sDescript
    HRSUP      40.0000   CIE     Nm. hres pour temps supplementaire
    TXSUP      1.5000    CIE     Taux pour heures supplémentaire
    TXSYN      0.0078    CIE     Taux cotisation syndicale
    In my DOS window, there is
    Code:
        Identification    Regle      Type    Description
    under Identification, I want the content of sIdentif to be displayed on my dos windows. same for fRegle, sType and sDescript.
    here's the part I did:
    Code:
    #include <stdio.h>
    #include <myconio.h>
    #include <ctype.h>
    #include <string.h>
    #include <stdlib.h>
    #include <math.h>
    
    int main()
    {
        gotoxy(34,7);
        puts ("TABLE DES REGLES");
        gotoxy(7,9);
        puts ("Identification");
        gotoxy(24,9);
        puts ("Regle");
        gotoxy(33,9);
        puts ("Type");
        gotoxy(41,9);
        puts ("Description");
        getch();
    
    }
    I just want the info of the file to be displayed under each of my for word (formated).

    thanks
    P.S. I would like to know how to put the dos window full size in my program
    Last edited by nevrax; 04-05-2007 at 06:50 PM.

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,166
    The only thing standard in your program are most of the header files and the puts() function. Everything else is non-standard or wrong (including your main() function definition). Please refer to the FAQ and post code that's more standard.
    under description, I want the content of sIdentif to be displayed on my dos windows.
    I don't understand why.

    Also, you haven't even started to try reading the file. Is that where you're stuck or are you stuck on positioning the text? Try to be more precise with your questions and do as much as you can on your own.
    If you understand what you're doing, you're not learning anything.

  3. #3
    Registered User
    Join Date
    Mar 2007
    Posts
    42
    Actually, I don't know what's wrong in my main (since I learned it this way with dev c++)(maybe you were talking about a void main (void). To be more precise, I want to display on the screen the content of my file like this
    Code:
        Identification    Regle     Type    Description // loccated in my program
        HRSUP             40.0000   CIE     Nm. hres pour temps supplementaire  //located in my file
        TXSUP             1.5000    CIE     Taux pour heures suppl&#233;mentaire
        TXSYN             0.0078    CIE     Taux cotisation syndicale
    This part of the program I want to create only show information contained in a file, no modification is needed. If I didn't put the "reading of the file part", it was just because I didn't know if there was something special to put there. By the way , I corrected my mistake, I want the content of sIdentif under Identification and not under Description(even if it dosn't change the logic, which I dont't understand.)
    Last edited by nevrax; 04-05-2007 at 06:53 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program Plan
    By Programmer_P in forum C++ Programming
    Replies: 0
    Last Post: 05-11-2009, 01:42 AM
  2. sequential file program
    By needhelpbad in forum C Programming
    Replies: 80
    Last Post: 06-08-2008, 01:04 PM
  3. gcc link external library
    By spank in forum C Programming
    Replies: 6
    Last Post: 08-08-2007, 03:44 PM
  4. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21