Basic Open File, Save/ Save as functions for dos word processor 
Author Message
 Basic Open File, Save/ Save as functions for dos word processor

Please post this message in an appropriate newsgroup, one of
borland.public.cpp.*
--

Paul Lutus
www.arachnoid.com

Quote:

>I am working on a small word processor...
>I have figured out how to do the word wrap, search, word find, word
count...
>now I HAVE TWO MAIN TASKS WHICH I SET OUT TO DO:
> could someone please provide me with the following...
>I AM USING A VERY OLD VERSION (DOS BASED) OF TURBO C...
>I am looking for a SIMPLE function which lists the files in a directory and
>ask the user for which file the would like to open .. and opens the file.
>Secondly I am looking for a simple function which saves to its orginal
>name.. however if this a new file i would like the the function to allow
the
>user to enter a name the would like the file saved as...

>LASTLY THE FOLLOWING CODE IS MY MENU - How do I go about linksing my
>functions to the menu... for example I have a word search function.. how
>would it run this function once someone selects the Search Option

>#include <menu.h>
>#include <stdio.h>

>void main ()
>{
>    unsigned char temp[3];
>    int num;
>    char menu [16][50] = ("&Save", "&Load", "&Edit", "<end>", "&Copy",
>"&Paste",
>    "&Search", "&Replace", "W&idth", "&Colours", "&Bold", "&Italics",
>"&About",             "<end>");

>clrscr ();

>num = ShowMenu ("&File| &Edit| &Options| &Help|", 4, menu,1);
>printf ("%d\n\n This is a test", num);

>while (!kbhit ());

>}

> I WOULD APPRECIATE RESPONSES THANKS....



Wed, 17 Oct 2001 03:00:00 GMT  
 Basic Open File, Save/ Save as functions for dos word processor
I am working on a small word processor...
I have figured out how to do the word wrap, search, word find, word count...
now I HAVE TWO MAIN TASKS WHICH I SET OUT TO DO:
 could someone please provide me with the following...
I AM USING A VERY OLD VERSION (DOS BASED) OF TURBO C...
I am looking for a SIMPLE function which lists the files in a directory and
ask the user for which file the would like to open .. and opens the file.
Secondly I am looking for a simple function which saves to its orginal
name.. however if this a new file i would like the the function to allow the
user to enter a name the would like the file saved as...

LASTLY THE FOLLOWING CODE IS MY MENU - How do I go about linksing my
functions to the menu... for example I have a word search function.. how
would it run this function once someone selects the Search Option

#include <menu.h>
#include <stdio.h>

void main ()
{
    unsigned char temp[3];
    int num;
    char menu [16][50] = ("&Save", "&Load", "&Edit", "<end>", "&Copy",
"&Paste",
    "&Search", "&Replace", "W&idth", "&Colours", "&Bold", "&Italics",
"&About",             "<end>");

clrscr ();

num = ShowMenu ("&File| &Edit| &Options| &Help|", 4, menu,1);
printf ("%d\n\n This is a test", num);

while (!kbhit ());

Quote:
}

 I WOULD APPRECIATE RESPONSES THANKS....


Thu, 18 Oct 2001 03:00:00 GMT  
 Basic Open File, Save/ Save as functions for dos word processor
A simple case will handle your mnu selections. I'm presuming num is returned
by a menu selection.

switch (num)
{
    case 0:
        save();
        break;
    case 1:
        load();
        break;

....

Greg Martin.

Quote:

>I am working on a small word processor...
>I have figured out how to do the word wrap, search, word find, word
count...
>now I HAVE TWO MAIN TASKS WHICH I SET OUT TO DO:
> could someone please provide me with the following...
>I AM USING A VERY OLD VERSION (DOS BASED) OF TURBO C...
>I am looking for a SIMPLE function which lists the files in a directory and
>ask the user for which file the would like to open .. and opens the file.
>Secondly I am looking for a simple function which saves to its orginal
>name.. however if this a new file i would like the the function to allow
the
>user to enter a name the would like the file saved as...

>LASTLY THE FOLLOWING CODE IS MY MENU - How do I go about linksing my
>functions to the menu... for example I have a word search function.. how
>would it run this function once someone selects the Search Option

>#include <menu.h>
>#include <stdio.h>

>void main ()
>{
>    unsigned char temp[3];
>    int num;
>    char menu [16][50] = ("&Save", "&Load", "&Edit", "<end>", "&Copy",
>"&Paste",
>    "&Search", "&Replace", "W&idth", "&Colours", "&Bold", "&Italics",
>"&About",             "<end>");

>clrscr ();

>num = ShowMenu ("&File| &Edit| &Options| &Help|", 4, menu,1);
>printf ("%d\n\n This is a test", num);

>while (!kbhit ());

>}

> I WOULD APPRECIATE RESPONSES THANKS....



Thu, 18 Oct 2001 03:00:00 GMT  
 Basic Open File, Save/ Save as functions for dos word processor

Quote:

> I am working on a small word processor...
> I have figured out how to do the word wrap, search, word find, word count...
> now I HAVE TWO MAIN TASKS WHICH I SET OUT TO DO:
>  could someone please provide me with the following...
> I AM USING A VERY OLD VERSION (DOS BASED) OF TURBO C...
> I am looking for a SIMPLE function which lists the files in a directory and
> ask the user for which file the would like to open .. and opens the file.
> Secondly I am looking for a simple function which saves to its orginal
> name.. however if this a new file i would like the the function to allow the
> user to enter a name the would like the file saved as...

Why not start with something easy like Edlin? It might make vi look like
a paragon of interactivity and helpfulness but for a basic text editor
it would be a good place to start. It's also far easier to implement
most of it using standard ANSI calls.

Quote:

> LASTLY THE FOLLOWING CODE IS MY MENU - How do I go about linksing my
> functions to the menu... for example I have a word search function.. how
> would it run this function once someone selects the Search Option

> #include <menu.h>
> #include <stdio.h>

> void main ()

int main (void) /*PLEASE*/

--
Marcus Houlden                                    ICQ: 29654055
PGP Key ID: 0x75B02986 Website: http://www.flimflam.demon.co.uk
Fingerprint: 75B2 3F36 FDD1 F2C4 491A  C03F 4287 08AE 75B0 2986
Old website:  http://members.xoom.com/mhoulden/ will soon close



Fri, 19 Oct 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. how to intercept Microsoft Word's file save function

2. Change file index filter of the standard file open/save dialog

3. Defaults for File Open & Save File As

4. ! Saving (graphics) to file - saving window contents (PICT) in Code warrior C (on a Mac PPC)

5. How to obtain name of file on Save/Save As

6. How to obtain name of file on Save/Save As

7. How to save a file that can be viewed using Microsoft word

8. How to save a file in Microsoft word format(.doc) or Rich text format

9. Saving files in WORD and RTF formats

10. Save As: Graphic File That Can be Used by Word

11. Saving files in WORD and RTF formats

12. Does dos save keystrokes into a file?

 

 
Powered by phpBB® Forum Software