Showing posts with label Programming. Show all posts
Showing posts with label Programming. Show all posts

Monday, July 16, 2007

C++ Copy File Function

CopyFile Function

This function is used to copy a file from a path to another file location/path.

The structure of the function as follow::

BOOL WINAPI CopyFile(
IN LPCSTR lpExistingFileName,
IN LPCSTR lpNewFileName,
IN BOOL bFailIfExists
);

Where::
lpExistingFileName is the source file location
lpNewFileName is the location where the file copy to
bFailIfExists is to set to replace or not.

bFailIfExists == true
The file won't be replaced.
bFailIfExists == false
The file will be replaced.

Wednesday, June 27, 2007

GDB - Code Debugger in Linux Enviroment

GDB is a tool for developer to debug the software when in Linux enviroment.

Run your application in debug mode
------------------------------------
1) gdb [application_name]
2) to set a break point
a) b [function_name]
b) b [document_name]:[line_number]
3) Start the application
run
4) Next line when in debug mode
n
5) Continue running when debug mode
c
6) Exit Debug Mode
q

Debugging Core Dump File
---------------------------
1) gdb [application_name] [core_dump_filename]
2) Debug the dump segment
b
3) Look into the dump segment
frame [segment_number]
4) Exit the debug mode
q