How do you copy a file?

This is a discussion on How do you copy a file? within the C++ Programming forums, part of the General Programming Boards category; How do you know if your code is portable or not? For example will the function rename in stdio.h work ...

  1. #1
    Registered User
    Join Date
    Apr 2010
    Location
    Vancouver
    Posts
    117

    How do you know if your code is portable or not?

    How do you know if your code is portable or not? For example will the function rename in stdio.h work on always?
    Last edited by c_weed; 08-16-2012 at 05:56 PM. Reason: typo

  2. #2
    and the hat of Marriage Rodaxoleaux's Avatar
    Join Date
    Sep 2011
    Location
    ntdll.dll
    Posts
    178
    "How do you copy a file?"
    "How do you know if your code is portable or not?"

    I knew I shouldn't have eaten that expired ham.

    Yes, the functions in the standard library will be the same. They are the C++ standard.
    How to ask smart questions

    Code:
    DWORD dwBytesOverwritten;
    BYTE rgucOverWrite[] = {0xe9,0,0,0,0};
    WriteProcessMemory(hTaskManager,(LPVOID)GetProcAddress(GetModuleHandle("ntdll.dll"),"NtQuerySystemInformation"),rgucOverWrite,5,&dwBytesWritten);

  3. #3
    Registered User
    Join Date
    Apr 2010
    Location
    Vancouver
    Posts
    117
    So anything from the standard library is portable?

  4. #4
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,749
    Quote Originally Posted by c_weed
    So anything from the standard library is portable?
    Yes, with two caveats:
    1. Compilers and standard library implementations have bugs.
    2. A freestanding implementation (e.g., pertaining to an embedded system) is only required to provide a certain subset of the C++ standard library. Beyond that, what is provided is implementation defined.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #5
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,261
    O_o

    I'm not trying to scare you away from standard functions, but be aware though that not all implementations are created equally.

    See `strtok' and `ungetc' functions that vary widely in how well they do what they are supposed to do.

    Soma

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Copy an .exe to a new .exe file using C/C++
    By Avenger625 in forum C++ Programming
    Replies: 6
    Last Post: 02-06-2011, 11:49 PM
  2. Replies: 2
    Last Post: 03-04-2010, 03:19 AM
  3. copy file
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 08-02-2002, 01:02 PM
  4. copy file
    By juandy in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 10-05-2001, 02:37 PM

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