Explore BrainMass

File Transferring in Visual C++

Visual C++
Write a program that takes a command line argument that is the name of a text file and creates a new file with a heading line
***************** file name ********************
and the contents of the original file with line numbers added. If the file's name contains a period, use the part of the name before the period concatenated with .lis as the name of the new file. Otherwise, just concatenate .lis with the whole file name.

Solution Preview

See also the attached file.
// file_name.cpp : Defines the entry point for the console application.

#include "stdafx.h"
#include <string.h>
#include <memory.h>
#include <conio.h>

static const int NAME_MAX = 255 ;
static const int MAX_LINE = 255 ;

void create_file_name(char* pfn, char* pn) ;
int create_new_file (char* p_old, char* p_name) ;

int main(int argc, char* argv[])
int n = argc;

if (argc < 2)
printf ("Command line argument was not given! Try again.") ;
return ...

Solution Summary

A Visual C++ program is written to transfer an old file to a new file.