|
Hi all
Fistly , I know this is a Visual C++ forum , but i really need help on my problem in C. So kindly bear with me !!
Here is the code I wrote to get the .bmp greyscale Image Header info in C
<br />
#include <stdio.h> <br />
#include <stdlib.h><br />
#include <math.h><br />
int main()<br />
{<br />
struct Image{<br />
int rows;<br />
int column;<br />
unsigned char *data;<br />
} sImage;<br />
FILE *fpr; <br />
FILE *fpw;<br />
int i,j;<br />
char imagein[20];<br />
char imageout[20];<br />
unsigned char *ptrC;<br />
unsigned char dummy;<br />
long filesize;<br />
int r, c;<br />
dummy = '0';<br />
ptrC = &dummy;<br />
<br />
printf("Enter input image : ");<br />
gets(imagein);<br />
printf("Enter output image : ");<br />
gets(imageout);<br />
<br />
<br />
if ((fpr = fopen(imagein, "rb"))==NULL){<br />
printf("Cannot open source file \n");<br />
exit(1);<br />
}<br />
if ((fpw = fopen(imageout, "w"))== NULL){<br />
printf("Cannot open target file.");<br />
fclose(fpr);<br />
exit(1);<br />
}<br />
<br />
fseek(fpr, 0, SEEK_SET);<br />
sImage.rows = getImageInfo(fpr, 22, 4);<br />
printf("Number of rows : %d",&sImage.rows);<br />
sImage.column = getImageInfo(fpr, 18, 4);<br />
printf("Number of columns : %d",&sImage.column);<br />
filesize = getImageinfo(fpr, 2, 4);<br />
printf("Filesize : %ld",&filesize);<br />
fseek(fpw, 0, SEEK_SET);<br />
r = sImage.rows;<br />
c = sImage.column;<br />
for (i=0; i<r; i++){<br />
for(j=0; j<c; j++){<br />
fread (ptrC, sizeof(char), 1, fpr);<br />
fwrite(ptrC, sizeof(char), 1, fpw);<br />
}<br />
}<br />
fclose(fpr);<br />
fclose(fpw);<br />
getch();<br />
return 0;<br />
}<br />
<br />
long getImageInfo(FILE* inputfile, long offset, int numberofchars)<br />
{<br />
unsigned char *ptrC;<br />
long value = 0L;<br />
unsigned char dummy;<br />
int i;<br />
<br />
dummy = '0';<br />
ptrC = &dummy;<br />
<br />
fseek(inputFile, offset, SEEK_SET);<br />
<br />
for(i=1; i<=numberOfChars; i++)<br />
{<br />
fread(ptrC, sizeof(char), 1, inputFile);<br />
<br />
value = (long)(value + (*ptrC)*(pow(256, (i-1))));<br />
}<br />
return(value);<br />
}<br />
<br />
And the error I get is :-
"Conflicting type of 'getImageInfo'. "
Could anyone please tell me , where i m possibly going wrong ....
Thanks a lot !!
|
|
|
|
|
I need get address of window that focus is on the it
thanks a lot
|
|
|
|
|
Windows have addresses?
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
hi
plz help me
I don't know how i can get active directory
plz help me how i con do it
thanks alot
|
|
|
|
|
Do you mean the GetCurrentDirectory() API or Directory Services[^]?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
of the directory the application is located on ... ?
|
|
|
|
|
Dear sir,
CAn anybody help me to guide how to restore and backup SQL server and MS access database using vc++...
|
|
|
|
|
gsheladia wrote: CAn anybody help me to guide how to restore and backup...MS access database using vc++...
Just the .mdb file(s)?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
thanks for your response.
Right now we required .mdb file(s) and later in second phase might be with sql server too..
|
|
|
|
|
gsheladia wrote: Right now we required .mdb file(s)...
So why not just use CopyFile() ?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
hi all,
i am trying out a win32 application. In that i am using SHFileOperation() to copy a file from one location to another. Will it be possible to pass the network credentials to this function(username and password)? This is required when i try to copy a file from a shared location that resides in a machine in another domain. In that case, copy fails since the share is not accessible, and also it won't ask for username and password before copying.
Pls give a hand of help
Thanks in advance
SYAMLAL
|
|
|
|
|
You might want to call NetUseAdd() first, and then call NetUseDel() after copying.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
hi
I got some code from
http://www.codersource.net/win32_network_drive.html
-----------------------------------------------------------
#include <windows.h>
#include <lm.h>
#include <tchar.h>
#include <stdio.h>
void main()
{
USE_INFO_2 mUseInfo2;
DWORD rc,error_param123;
wchar_t lszDomain[200];
wchar_t lszLocal[200];
wchar_t lszPwd[200];
wchar_t lszRemote[200];
wchar_t lszUser[200];
mbstowcs(lszDomain, "DOMAIN", 200);
mbstowcs(lszLocal, "", 200);
mbstowcs(lszPwd, "PASSWORD", 200);
mbstowcs(lszRemote, "\\\\MACHINENAME\\C$", 200);
mbstowcs(lszUser, "USERNAME", 200);
memset( &mUseInfo2, '\0', sizeof(mUseInfo2) );
mUseInfo2.ui2_asg_type = USE_WILDCARD;
mUseInfo2.ui2_domainname = (char *)lszDomain;
mUseInfo2.ui2_local = (char *)lszLocal;
mUseInfo2.ui2_password =(char *)lszPwd;
mUseInfo2.ui2_remote =(char *)lszRemote;
mUseInfo2.ui2_username =(char *)lszUser;
rc = NetUseAdd( NULL, 2, (BYTE *)&mUseInfo2, &error_param123);
if(rc == 0)
{
printf("Authenticated \n");
}
else
{
printf("Error during Drive Mapping Authentication: %d \n");
}
return ;
}
----------------------------------------------------------------
But it won't give any drive letters in mycomputer after mapping.
Why is it so??
SYAMLAL
|
|
|
|
|
SyamlalS wrote:
But it won't give any drive letters in mycomputer after mapping.
Since mUseInfo2.ui2_local is empty, why would you expect it to?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi
Does anyone know how to write debug messages in the VC++ debug window using a c++ application, MFC application and WIN32 application.
Thanks in advance
|
|
|
|
|
Use TRACEx () , where x can be 1, 2, .....
Come online at:-
jubinc@skype
|
|
|
|
|
There's also OutputDebugString() (which the trace macros eventually call)
|
|
|
|
|
I create a new project: a library of classes (NET).
I added only this simple function in the class:
#pragma once<br />
using namespace System;<br />
namespace LibNET<br />
{<br />
public __gc class Class1<br />
{<br />
void Fun(){<br />
int *p;<br />
p=new int;
}<br />
};<br />
}<br />
But I get this error:
LibNET error LNK2001: "void * __cdecl operator new(unsigned int)" (??2@$$FYAPAXI@Z) external symbol unresolved
what is the reason?
Have I to include something?
Thanks.
Cheers,
Russell
|
|
|
|
|
I found the way to complete the compilation/linker process:
Property Project / Linker / Input / Addictional dependencyes
add this library: "msvcrt.lib"
Then....no more LNK2001 or LNK1120 errors.
Now I have to understand if my dll will really work.
Cheers,
Russell
|
|
|
|
|
as far as this is managed C++, it doesn't belong to this forum...
BTW, shouldn't you use gcnew instead ?
|
|
|
|
|
Of course...the other forum...but... well...here I can found more people!
And It was a very simple question: it was at the entry level, not a really Managed programming.
About gcnew: I use VS2003, there that command is unknown. I migrate as soon as possible to VS2005, but I haven't enough money at this moment
Thanks
Cheers,
Russell
|
|
|
|
|
oh, then why not asking directly in the lounge...
for gcnew, i don't know anything to managed C++ and C++/CLI, so i suggested it like that...
try the MC++ forum anyway, i'm sure some could tell
|
|
|
|
|
How to get the path of My Computer and My Network Places.
|
|
|
|
|
|
Those folders aren't part of the file system, they don't have paths.
|
|
|
|