|
i want to identify that machine is online or offline through programming.if anybody know how it is possible and have any example please share with me .
Bankey Khandelwal
Software Engineer
|
|
|
|
|
Bankey Khandelwal wrote: i want to identify that machine is online or offline through programmin
InternetGetConnectedStateEx
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
This[^] will make good reading too.
Nibu thomas
Software Developer
|
|
|
|
|
Im looking for MS Visual C++ Naming conventions. The naming conventions I know are from Visual Basic. I don't know if its ok to adopt the naming conventions from VB. If you know some articles on Visual C++ please let me know. Thanks.
|
|
|
|
|
|
I have some codes work properly under 32bit windows, but can't work under x64-based windows, such as win2003server/win64 XP pro, i don't want to rewrite my code, what should i do?
I am still use VC6 with service package5, can it compile the 64bit application
Tomorrow may not exciting, but the exciting tomorrow will surely come.
-- modified at 21:38 Sunday 19th March, 2006
|
|
|
|
|
VC++ 6.0 / Visual C++ 2003 are strictly 32bit, Visual Studio 2005 (including express editions) are the first offical Microsoft compilers to support x64 builds - From what I remember some of the more recently DDK's released before VS 2005 shipped with some sort of x64 support aswell but can't verify that though as I don't have any to hand.
Most code should be a pretty easy move across, it's worth checking out this[^] set of articles on MSDN which are a pretty good starting point on the new compiler, some of it's driver development specific but most of it's going to be relivent.
<edit>If your having problems actually running VS 6.0 on x64 - I don't know about that one and wont be able to try it until midweek, but I do know 2003 works fine</edit>
Gavin Taylor
w: http://www.gavspace.com
-- modified at 22:30 Sunday 19th March, 2006
|
|
|
|
|
It seems that i have to use the VS .NET 2005 to solve my trouble, any way, thanks very much!
|
|
|
|
|
i have 2 files :
file1.txt have a stream of "1010011"
file2.txt have a message :
The amount of energy used in buildings depends firstly on WHAT IT IS USED FOR.
i want to print to file3. the algoritm is simple:
read all char in file2 one by one and print in file3<br />
if char in file2 == space <br />
if char in file 1=='1'<br />
print 2 space in file3<br />
else if char in file1=='0'<br />
print 1 space in file3
below is my code
Binary=fopen("file1.txt","r");<br />
Message=fopen("file2.txt","r");<br />
Output=fopen("file3.txt"."w");<br />
while(true)<br />
{<br />
BinaryBuff=fgetc(Message);
if(feof(Message))<br />
break;<br />
<br />
else if (BinaryBuff=='A')<br />
fprintf(Output,"A");<br />
else if (BinaryBuff=='B')<br />
fprintf(Output,"B");<br />
else if (BinaryBuff=='C')<br />
fprintf(Output,"C");<br />
<br />
else if(BinaryBuff==' ')
{<br />
while (true)<br />
BinaryBuff==fgetc(Binary);<br />
if(BinaryBuff=='1')<br />
fprintf(Message," ")
else if (BinaryBuff=='0');<br />
fprintf(Message," ");
<br />
}<br />
<br />
}
the output in file3 should be :
The(2space)amount(1space)of(2space)energy(1space)used(1space)in(2space)buildings(2space)depends firstly on WHAT IT IS USED FOR.
but not work. what can i do???
HelpMe
|
|
|
|
|
Give more details - what do you mean "does not work"? It crashes? Nothing in output file?
From looking at the code, beardy janggut wrote: fprintf(Message," ")//print 2 space
this tries to write the spaces to the MESSAGE file - should be to OUTPUT.
|
|
|
|
|
I'm an infant when it comes to C++.
Can anybody help me to access a text file which has a comma that separates every item and after which put that file into an array which can be access later.
The problem is the items in a file are in this manner, each line:
char,int,int,int,long int,long int........
char,int,int,int,long int,long int........
char,int,int,int,long int,long int........
char,int,int,int,long int,long int........
........
.............
.........
......
upto 57-60 lines
Do i have to separate the char and int and long int and put it in different array?
Or put the items in a struct....
|
|
|
|
|
The way you have presented it, it looks like the choice is one of personal preference, rather than necessity.
How much coding is already done? Do you already have in place the code for reading the file line by line and parsing the data, or not?
Rich
|
|
|
|
|
Currently I've coded a chunk of code that extracts line by line. I've coded in Visual Basic and successfully extracted each of the input using this code.
Open FilePath For Input As #1
Delimiter = ","
SegmentCount = 1
ReDim TheSegments(1)
Do Until EOF(1)
DoEvents
If UBound(TheSegments) = SegmentCount Then
ReDim Preserve TheSegments(SegmentCount + 10)
End If
' Read a line from the vin file
Line Input #1, TheString
' Parse the line
SubStrings = Split(TheString, Delimiter, -1, vbTextCompare)
' Transfer all data to a Segment
'&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
' Get the name(description)
TheSegments(SegmentCount).Name = SubStrings(0)
' Get the Front Plane
TheSegments(SegmentCount).FrontPlane = Val(SubStrings(1))
' Get the Back Plane
TheSegments(SegmentCount).BackPlane = Val(SubStrings(2))
' Get the Color
TheSegments(SegmentCount).Color = Val(SubStrings(3))
' Calculate the number of pixels
PixelCount = UBound(SubStrings) - 4
TheSegments(SegmentCount).PixelCount = PixelCount
' Now get all the pixel positions
For Count = 1 To PixelCount
TempLong = Val(SubStrings(Count + 3))
'TheSegments(SegmentCount).Pixels(Count).Val = TempLong
TheSegments(SegmentCount).Pixels(Count).x = TempLong Mod 320
TheSegments(SegmentCount).Pixels(Count).y = TempLong \ 320
Next
'&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
SegmentCount = SegmentCount + 1
'''''''''''''''''''''''''''
Loop
Close #1
End Sub
In C++ i have no idea how to deal with this... I'm currently into self indulgement with this language at the same time working on Hardware and Software design of my project LCD USB Emulator...
|
|
|
|
|
So you want to pass the data to a C++ routine after it has been extracted by the VB program, or you just want to translate all of the VB code into a C++ program?
|
|
|
|
|
I just want to translate the VB code into C++ program. It's a bit difficult on my part.
Thanks
|
|
|
|
|
Hi Kuroro,
How about fscanf ?
Regards,
Chris
|
|
|
|
|
I'm currently studying string extractions. I can't focus really on software side coz i'm also designing the hardware...
Thanks Chris, I'll be trying it....
|
|
|
|
|
What does the dots at the end of each line signify?
Steve
|
|
|
|
|
char char_val;
int int_val1, int_val2, int_val3;
long int longint_val1;
char comma;
ifstream fs("C:\\a.txt");
if ( !(fs >> char_val >> comma) || comma!=',')
{
}
if ( !fs >> int_val1 >> comma) || comma!=',')
{
}
Steve
|
|
|
|
|
Steve,
Sorry for the dot stuff, that signifies another input of type long int... actually the first entry is Char, then the second, third and the fourth is of type int, the fifth until end of line is a type of long int. each line have different number of items.
I'm not good in explaining things.
Thanks Steve
|
|
|
|
|
Thanks a lot Steve, I'm currently coding it in my C++ BuilderX compiler.
Thanks........
|
|
|
|
|
To me, each line looks like a struct constisting of a std::string , 3 ints and a std::vector of longints.
The constructor of this struct can take a line of the file, parse it and fill the fields.
getline would be the method to - erm - get the line from the file.
For parsing, you could use fscanf or look at e.g. www.boost.org[^]for a parsing library.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
Steve,
Actual items in the file M637.VIN
M2,2,1,15,55342,55662,55982,56302
A,4,1,15,58856,59176,59496,59816
P,5,1,15,55327,55647,55967
B,7,1,15,55310,55630,55950,56270
4B,8,2,15,27769,25530
General format:
char_val,int_val1,int_val2,int_val3,longint_val1
is it possible to store these stuff in a struct or an array of some sort? Coz i need int_val1 and int_val2 as a reference to an output port. in line 1 "M2,2,1" , i need to access the extracted input 2 and 1 coz it corresponds to an output port2 and port1.
on the other hand, char_val must be taken into account coz it serves as a reference to longint_val(n).
Thanks,
Kuroro
|
|
|
|
|
Hi Coders
I have a Visual C++ 2005 solution made up of two projects with lots of source fles (containing functions only) that produce two separate dlls.
In one source file I calculate a value in a variable and I want that variable to have global scope across the two projects. Is that possible? The value in the variable is needed by all the other functions in the two projects to work properly.
I have tried declaring the variable in header file and before the call to dllmain but neither approach works. I can't use a macro because the I have to recalculate the value each time the dlls are used.
Any suggestions would be much appreciated.
Regards
Jeremy
|
|
|
|
|
Hi Jeremy,
I didn't catch your question very well. If u r talking about two dlls that are called by one executable module, which means that they are running in the same process, I would like you try to declare a variable in the exe file, pass a pointer to it to both dlls and reference this variable to share info.
If they are running in different processes, I would suggest you use some ipc apporach, for example Create/OpenFileMapping thing.
Regards,
Chris
|
|
|
|
|