May i know How To Save....please?

This is a discussion on May i know How To Save....please? within the C Programming forums, part of the General Programming Boards category; Dear everybody, kindly please help me out with this problem. and i'm thinking to add in few commands for my ...

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    8

    May i know How To Save....please?

    Dear everybody,

    kindly please help me out with this problem.
    and i'm thinking to add in few commands for my program in order to make it able to save the input from user, but i have no idea where or which line to insert it, any help would be appreciated.

    thank you so so much.
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    22

    Thumbs up not appreciating code...

    first u have to learn--"how to write code in readable format".
    i don't have any desire to see that any more.

    thanx...
    Jackie

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >in order to make it able to save the input from user
    You mean 'ask' it to save input from the user. Programs are living organisms that hate you, you have to be nice.

    By save input, what exactly do you mean? You are already saving the user input to memory when you place it in variables. Where else do you want to save it?

    >first u have to learn--"how to write code in readable format".
    Wha? I didn't see any real problem with the formatting of the code.

    -Prelude
    My best code is written with the delete key.

  4. #4
    Registered User
    Join Date
    Feb 2002
    Posts
    11

    Cool

    I got lost somewhere around
    if (a==1)
    Invoice_Func();

    What ever happend to making all function call from withing the main function?

  5. #5
    Registered User
    Join Date
    Feb 2002
    Posts
    8
    I'm trying to save the input from user into .txt or .dat format.

    something similiar to the attachement.
    i'm trying to copy and paste it to my program, but i have no idea how, as you can see, that i'm new to this and not good in programming, that's wy my program is a mess.
    any comment is appreciated. thank you very much.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    Feb 2002
    Posts
    8

    some changes....

    i've made some changes to the program, but still it's a mess, kindly please ignore the previous one. thank you.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    Dec 2001
    Posts
    108
    Write a binary mode file to disk that contains the contents of an array that holds all of the user input.

    Declare a pointer to a type FILE structure, and use the fwrite() function.

    When you run the program again, use the fread() function to read back into the array the previous user input.

    Search through the STDIO.H file, to see all of the function prototypes that you can pass a pointer to a FILE structure, there are many more.

    One very good book that will teach you how to use these functions, is Sams Teach Yourself C in 21 Days.
    Last edited by DarkStar; 03-15-2002 at 08:37 AM.

  8. #8
    Registered User
    Join Date
    Dec 2001
    Posts
    108
    I don't know if this is exactly what you are wanting, but the source file below should compile and link to an executable. When you run the program it will write a text file to the Windows Desktop and open it automatically in NOTEPAD (assuming you are using a Win9x OS).

    This should be enough to give you a jump start in saving program I/O to disk.

    Other programmers on this site can do far better than what I have done here, so this is certainly not the best way to save information.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    Jan 2002
    Posts
    11

    saving to file

    Hi there,
    Well i couldn't make much out of your code, however i understand you want to invoice furniture and save the invoices on a file on disk. The following code should get you started. It tests for a file called "furnish" on your hard drive and if it doesn't find it it creates it, this is the data file for your program, the rest of the code just write details of the invoice to the disk.

    I will need to leave it to you to write the code to read the file back to screen, however i have included code to repeat the variables back onto the screen as you type. You can use code based on my code to read the file back into memory and then review and format and print the invoices.

    Ok if you get any more probs you can post again, the program is not fully error checked so don't enter illegal keys, or it might hang. If you make alterations to the code it is a good idea to delete the data file from the hard disk and allow the program to recreate it. So don't enter too much test data between alterations or you will have to put it back in again.

    I was using the Bloodshed compiler www.bloodshed.net
    Attached Files Attached Files
    If its not 5.00p.m. on Friday its crap!!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Save vs Save As.... OPENFILENAME flags
    By csonx_p in forum Windows Programming
    Replies: 16
    Last Post: 06-01-2008, 02:42 PM
  2. Replies: 2
    Last Post: 05-09-2008, 07:27 AM
  3. save and save as functions
    By willc0de4food in forum Windows Programming
    Replies: 2
    Last Post: 06-29-2005, 02:49 AM
  4. save webpage? some save some not
    By kryptkat in forum Tech Board
    Replies: 3
    Last Post: 06-07-2005, 09:21 AM
  5. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 09:33 AM

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