Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

C:Somedirdir to C:\Somedir\dir ?

Hi,
The user Inputs a directory path via an edit box.
I can store the input, or display it.But I wish to convert the "" to
"\" .
What do I need to do, The input is stored in char path[MAX_PATH];
No MFC,
BCC5.5

Thanks in advance,
Oldfella

Comments

  • AsmGuru62AsmGuru62 Member Posts: 6,519
    [b][red]This message was edited by AsmGuru62 at 2002-10-15 7:8:25[/red][/b][hr]
    : Hi,
    : The user Inputs a directory path via an edit box.
    : I can store the input, or display it.But I wish to convert the "" to
    : "\" .
    : What do I need to do, The input is stored in char path[MAX_PATH];
    : No MFC,
    : BCC5.5
    :
    : Thanks in advance,
    : Oldfella
    :
    [blue]Why to convert the ''s? You can use path as it was entered.[/blue]


  • OldfellaOldfella Member Posts: 6
    : [b][red]This message was edited by AsmGuru62 at 2002-10-15 7:8:25[/red][/b][hr]
    : : Hi,
    : : The user Inputs a directory path via an edit box.
    : : I can store the input, or display it.But I wish to convert the "" to
    : : "\" .
    : : What do I need to do, The input is stored in char path[MAX_PATH];
    : : No MFC,
    : : BCC5.5
    : :
    : : Thanks in advance,
    : : Oldfella
    : :
    : [blue]Why to convert the ''s? You can use path as it was entered.[/blue]
    :
    :
    :
    Hi AsmGuru62,
    What I am trying to do is use the users input eg C: and use that input
    for CopyFile, To the best of my knowledge, Copy file needs'\'
    eg User Input= C:mydir stored in char path[MAX_PATH];
    CopyFile("Prog.exe",path,FALSE); Normaly 'path' would be "C:\mydir
    Am I on the rite track?
    If not how should I go about using the input to copy a file to the inputed(allready existing) directory?
    Thanks,
  • AsmGuru62AsmGuru62 Member Posts: 6,519
    : : [b][red]This message was edited by AsmGuru62 at 2002-10-15 7:8:25[/red][/b][hr]
    : : : Hi,
    : : : The user Inputs a directory path via an edit box.
    : : : I can store the input, or display it.But I wish to convert the "" to
    : : : "\" .
    : : : What do I need to do, The input is stored in char path[MAX_PATH];
    : : : No MFC,
    : : : BCC5.5
    : : :
    : : : Thanks in advance,
    : : : Oldfella
    : : :
    : : [blue]Why to convert the ''s? You can use path as it was entered.[/blue]
    : :
    : :
    : :
    : Hi AsmGuru62,
    : What I am trying to do is use the users input eg C: and use that input
    : for CopyFile, To the best of my knowledge, Copy file needs'\'
    : eg User Input= C:mydir stored in char path[MAX_PATH];
    : CopyFile("Prog.exe",path,FALSE); Normaly 'path' would be "C:\mydir
    : Am I on the rite track?
    : If not how should I go about using the input to copy a file to the inputed(allready existing) directory?
    : Thanks,
    :
    [blue]That was my point, exactly - the '\' needs only when you type a constant string as a path:

    char* pstrDir = "C:\MyFolder\MyFile.Bin";

    but in case you get the file name from a user - use it without any problems:

    char bufSrc [260]; // Source file path
    char bufDest [260]; // Destination folder

    //...get the user input into 'bufSrc' and 'bufDest'
    CopyFile (bufSrc, bufDest, FALSE);

    Also, I do not think you can hope that 'CopyFile()' will create the target folder for you. You have to create the folder if it is not there - call CreateDirectory().[/blue]
  • Justin BibJustin Bib USAMember Posts: 0

    _________ ( http://forcoder.org ) free ebooks and video tutorials about [ JavaScript Perl C# PL/SQL Assembly C++ MATLAB Go Visual Basic Python Java Objective-C Visual Basic .NET R PHP Scratch Ruby Delphi C Swift ML Bash Dart Clojure Awk Lua Ada LabVIEW Scheme Fortran FoxPro Apex COBOL D Kotlin Lisp VBScript Logo Alice Transact-SQL Crystal ABAP Rust Prolog Scala F# Hack Julia Erlang SAS ] __________

Sign In or Register to comment.