Click here to Skip to main content
15,902,810 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Upload file using Wininet Pin
Member 65656012-Nov-03 0:58
Member 65656012-Nov-03 0:58 
GeneralProblem storing pointer to parent Pin
srev11-Nov-03 9:20
srev11-Nov-03 9:20 
GeneralRe: Problem storing pointer to parent Pin
TFrancis11-Nov-03 9:45
TFrancis11-Nov-03 9:45 
GeneralRe: Problem storing pointer to parent Pin
srev11-Nov-03 9:50
srev11-Nov-03 9:50 
GeneralRe: Problem storing pointer to parent Pin
Christian Graus11-Nov-03 9:46
protectorChristian Graus11-Nov-03 9:46 
GeneralRe: Problem storing pointer to parent Pin
Antti Keskinen11-Nov-03 10:13
Antti Keskinen11-Nov-03 10:13 
GeneralRe: Problem storing pointer to parent Pin
srev11-Nov-03 10:44
srev11-Nov-03 10:44 
GeneralCompiling error Pin
Azzedine11-Nov-03 9:07
Azzedine11-Nov-03 9:07 
Dear All,

I compiled a project under Unix, I have got the following errors:

------------------------------------------
CC -I. -DUNIX -c XPCFileStat.C -g -o XPCFileStat.o
"XPCFileStat.C", line 11: Warning: String literal converted to char* in formal argument sMsg in call to XPCException::XPCException(char*).
"XPCFileStat.C", line 20: Warning: String literal converted to char* in formal argument sMsg in call to XPCException::XPCException(char*).
"XPCFileStat.C", line 28: Warning: String literal converted to char* in formal argument sMsg in call to XPCException::XPCException(char*).
"XPCFileStat.C", line 36: Warning: String literal converted to char* in formal argument sMsg in call to XPCException::XPCException(char*).
"XPCFileStat.C", line 48: Warning: String literal converted to char* in formal argument sMsg in call to XPCException::XPCException(char*).
"XPCFileStat.C", line 59: Warning: String literal converted to char* in formal argument sMsg in call to XPCException::XPCException(char*).
"XPCFileStat.C", line 70: Warning: String literal converted to char* in formal argument sMsg in call to XPCException::XPCException(char*).
"XPCFileStat.C", line 77: Error: The "&" operator can only be applied to a variable or other l-value.
"XPCFileStat.C", line 221: Warning: String literal converted to char* in formal argument sMsg in call to XPCException::XPCException(char*).
"XPCFileStat.C", line 228: Error: The "&" operator can only be applied to a variable or other l-value.
2 Error(s) and 8 Warning(s) detected.
*** Error code 2
make: Fatal error: Command failed for target `XPCFileStat.o'
------------------------------------------------------
Here is the main part of the program:

#include <xpcfilestat.h>
#include <iostream.h>

XPCFileStat::XPCFileStat()
{
long lMaxpath;

// Determine the maximum size of a pathname
if ((lMaxpath = pathconf("/", _PC_PATH_MAX)) == -1)
{
XPCException newExcept("Could not determine maximum pathname length"); // warning line 11
throw newExcept;
return;
}

// Allocate memory for the pathname
cFileName = new char[lMaxpath + 1];
if (!cFileName)
{
XPCException newExcept("Could not allocate memory for cFileName"); // warning line 20
throw newExcept;
return;
}

// Store the current working directory
if (getcwd(cFileName, lMaxpath) == NULL)
{
XPCException newExcept("Could not get current working directory"); // warning line 28
throw newExcept;
return;
}

// Retrieve the file's statistics
if (lstat(cFileName, &sStatBuf) == -1)
{
XPCException newExcept("Could not obtain statics on directory."); // warning line 36
throw newExcept;
return;
}
}

XPCFileStat::XPCFileStat(char *_psFileName)
{
// Allocate memory to store the pathname
cFileName = new char[strlen(_psFileName)+1];
if (!cFileName)
{
XPCException newExcept("Could not allocate memory for cFileName"); // warming line 48
throw newExcept;
return;
}

// Copy the pathname to the private data member
strcpy(cFileName, _psFileName);

// Retrieve the file's statistics
if (lstat(cFileName, &sStatBuf) == -1)
{
XPCException newExcept("Could not obtain statics on directory."); // warning line 59
throw newExcept;
return;
}
}

XPCFileStat::XPCFileStat(const XPCFileStat &_oldClass)
{
cFileName = new char[sizeof(_oldClass.cFileName)+1];
if (!cFileName)
{
XPCException newExcept("Could not allocate memory for cFileName");// warning line 70
throw newExcept;
return;
}

strcpy(cFileName, _oldClass.sGetFileName());

memcpy((void *)&sStatBuf, (void *)&_oldClass.getStatBuf(), sizeof(struct stat)); //here is first error
}

enum eDirectoryTypes XPCFileStat::iGetFileType()
{
// Extract the file type bits from st_mode and match them up with
// the file type constants

switch(sStatBuf.st_mode & S_IFMT)
{
..............................
}
}

enum ePermissions XPCFileStat::iGetOwnerPermissions()
{
// Extract the owner permission bits and return the appropriate
// permission value

switch(sStatBuf.st_mode & S_IRWXU)
{
.......................................................
}
}

enum ePermissions XPCFileStat::iGetGroupPermissions()
{
// Extract the group permission bits and return the appropriate
// permission value

switch(sStatBuf.st_mode & S_IRWXG)
{
..................................................
}
}

enum ePermissions XPCFileStat::iGetOtherPermissions()
{
// Extract the "other users" permission bits and return the appropriate
// permission value

switch(sStatBuf.st_mode & S_IRWXO)
{
......................................
}
}

XPCFileStat &XPCFileStat::operator=(const XPCFileStat &_oldClass)
{
if (this == &_oldClass)
return *this;

if (sizeof(cFileName) < sizeof(_oldClass.sGetFileName()))
{
delete [] cFileName;
cFileName = new char[sizeof(cFileName)];
if (!cFileName)
{
XPCException newExcept("Could not allocate memory for cFileName"); // warning line 221
throw newExcept;
return *this;
}
}

memcpy((void *)cFileName, (void *)_oldClass.sGetFileName(), sizeof(_oldClass.sGetFileName()));
memcpy((void *)&sStatBuf, (void *)&_oldClass.getStatBuf(), sizeof(struct stat)); // here is the 2 error
}

=======================================================================

I would be glag if someone would help me to solve at least those two errors. Your help will be appreciated!

Thank you in advance for your reply.






Regards,
Azzedine
GeneralRe: Compiling error Pin
David Crow11-Nov-03 9:46
David Crow11-Nov-03 9:46 
QuestionReduce flicker in ListView ? Pin
_skidrow_vn_11-Nov-03 7:59
_skidrow_vn_11-Nov-03 7:59 
AnswerRe: Reduce flicker in ListView ? Pin
David Crow11-Nov-03 8:18
David Crow11-Nov-03 8:18 
GeneralRe: Reduce flicker in ListView ? Pin
Signal-911-Nov-03 8:39
Signal-911-Nov-03 8:39 
GeneralRe: Reduce flicker in ListView ? Pin
David Crow11-Nov-03 8:44
David Crow11-Nov-03 8:44 
GeneralRe: Reduce flicker in ListView ? Pin
Signal-911-Nov-03 11:40
Signal-911-Nov-03 11:40 
GeneralRe: Reduce flicker in ListView ? Pin
David Crow12-Nov-03 2:58
David Crow12-Nov-03 2:58 
GeneralRe: Reduce flicker in ListView ? Pin
Signal-912-Nov-03 9:37
Signal-912-Nov-03 9:37 
Generalopening a web file Pin
doctorpi11-Nov-03 7:57
doctorpi11-Nov-03 7:57 
GeneralRe: opening a web file Pin
David Crow11-Nov-03 8:12
David Crow11-Nov-03 8:12 
GeneralRe: opening a web file Pin
doctorpi11-Nov-03 8:16
doctorpi11-Nov-03 8:16 
GeneralRe: opening a web file Pin
RaajaOfSelf11-Nov-03 22:40
RaajaOfSelf11-Nov-03 22:40 
GeneralRe: opening a web file Pin
Chris Hills12-Nov-03 23:07
Chris Hills12-Nov-03 23:07 
Generalopen a workbrook automation excel Pin
jerome_data11-Nov-03 7:55
jerome_data11-Nov-03 7:55 
GeneralRe: open a workbrook automation excel Pin
David Crow11-Nov-03 8:05
David Crow11-Nov-03 8:05 
GeneralRe: open a workbrook automation excel Pin
jerome_data11-Nov-03 8:13
jerome_data11-Nov-03 8:13 
Generalupdating system on environment variable changes Pin
Jim Crafton11-Nov-03 7:32
Jim Crafton11-Nov-03 7:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.