VC++Question
VC++Question
Hello, I need to copy a file in the SYS32 dir to another dir...here is the code that doesn't work:
// copy the old dll for backup.
FILE* saveold = fopen( "\\DLLPATCH\\BACKUP\\uxtheme.dll", "wr" );
int ch;
do
{
ch = fgetc( fileput );
fputc( ch, saveold );
}
while ( ch != EOF ); // end of file.
why?
// copy the old dll for backup.
FILE* saveold = fopen( "\\DLLPATCH\\BACKUP\\uxtheme.dll", "wr" );
int ch;
do
{
ch = fgetc( fileput );
fputc( ch, saveold );
}
while ( ch != EOF ); // end of file.
why?
Re:VC++Question
First off, is this a compile-time error or a run-time error.
Second off, it appears that you are putting the ch back into the file you opened for reading. I'd open the original file as
FILE* readold = fopen( "\\DLLPATCH\\uxtheme.dll", "r" );
And then have
FILE* saveold =fopen("\\DLLPATCH\\BACKUP\\uxtheme.dll","w");
Or something like that, and then modify your do statement to read from readold and write to saveold.
Third off, am I confused or what? but what's with those double back-slashes? As far as I know, MSWIN uses a single back-slash for file separators.
Hope that helps.
Second off, it appears that you are putting the ch back into the file you opened for reading. I'd open the original file as
FILE* readold = fopen( "\\DLLPATCH\\uxtheme.dll", "r" );
And then have
FILE* saveold =fopen("\\DLLPATCH\\BACKUP\\uxtheme.dll","w");
Or something like that, and then modify your do statement to read from readold and write to saveold.
Third off, am I confused or what? but what's with those double back-slashes? As far as I know, MSWIN uses a single back-slash for file separators.
Hope that helps.
Re:VC++Question
don't forget, you may need to state that it's a binary file.
so use "rb" and "wb" or else it will mangle your new line characters for you.
also, is the input file handle at the start of the file?
- Nick
so use "rb" and "wb" or else it will mangle your new line characters for you.
also, is the input file handle at the start of the file?
- Nick
Re:VC++Question
Ok, i'll try that code and the rb stuff...
btw this is going to be for a UXTHEME.DLL patching utility for Windows XP and .NET server 2003 - letting you freely use StyleXP themes. It'll be on the web soon...and i've posted here before ...but won't again( after this thread )...because I had too... ( don't know much Win32 programming ).
btw this is going to be for a UXTHEME.DLL patching utility for Windows XP and .NET server 2003 - letting you freely use StyleXP themes. It'll be on the web soon...and i've posted here before ...but won't again( after this thread )...because I had too... ( don't know much Win32 programming ).
Re:VC++Question
how to get the connected nodes ipaddress in vc++
how to connect to a particular node
how to connect to a particular node
Re:VC++Question
You're confused Actually, the double backslashes are because C and its relatives all use a single backslash for escape codes, so that non-printing characters,(e.g., "\00" for an ASCII NUL character) or characters with special values (e.g., """ for a double quote) can be inserted in to strings. Because of this, the backslash itself needs to be escaped in order to have it in a string, and the code for it is, naturally enough, "\".Andrew_Baker wrote: Third off, am I confused or what? but what's with those double back-slashes? As far as I know, MSWIN uses a single back-slash for file separators.
I imagine you knew this, but that it didn't click in the context.
Re:VC++Question
Thankyou! Now, how do I rename a file? I found the movefile function also.
Re:VC++Question
I found how to rename and delete files, using CFile::RenameFile and DeleteFile. THankyou.
Re:VC++Question
I have one more question. Why won't CFile::Remove work? It keeps saying "Acess to unnamed file is denyed"? But there IS a file that I need to delete...it says the same thinge with CFile::Rename when I try to rename to a file that is alredy there. How do I delete a file? here is the code that won't work:
// Delete temp stuff:
CFile::Remove( "\\uxtheme.tmp" );
CFile::Remove( "\\uxtheme.tm2" );
Why won't this work/how can I get it to work? I'm using Microsoft Visual C++ 5.0 on Windows .NET Server 2003 build 3663 on a NTFS file system. It won't work on FAT either.
// Delete temp stuff:
CFile::Remove( "\\uxtheme.tmp" );
CFile::Remove( "\\uxtheme.tm2" );
Why won't this work/how can I get it to work? I'm using Microsoft Visual C++ 5.0 on Windows .NET Server 2003 build 3663 on a NTFS file system. It won't work on FAT either.
Re:VC++Question
Try the Win32 DeleteFile function, then use GetLastError to obtain the full error code.
Instead of GetLastError you can add the string err,hr into the VC++ watch window and it will give you a description of the last error that occurred.
Instead of GetLastError you can add the string err,hr into the VC++ watch window and it will give you a description of the last error that occurred.