|
Also you can write:
CString user, message;
CString command;
command.Format("net send %s %s", user.GetBuffer(0), message.GetBuffer(0));
system(command.GetBuffer(0));
A. Riazi
|
|
|
|
|
ok im only in CS 1 now...and i have pretty n00b like skills compared to u guys...so here----i dont know what "%s" is or what CString user, message is or what command.Format is etc etc etc....my knowledge is prety limited when it comes to what u all are talking about...please let me know what u are doing as u are doing it so i understand it....thanks. and also, i want to make clear that i want USER to be a char variable that someone enters in, and i want MESSAGE to be another char variable that will be the message sent....
ex.
"USER = " cin >> BoyceCarter //my comp address
"Message = " cin >> HEY WHATS UP //also how can u make a message to hold more than just one word.... cause i've tried to do that with my simple net send command ("net send BoyceCarter HI YOU") and all that comes back is HI...not the whole HI YOU part...etc thanks so much
~carter
|
|
|
|
|
Carter
Okay in simple terms
%s is a place holder for whatever you want in it. For example:
line 1. char somestring[] = "really cool";
line 2. sprintf("This is %s", somestring);
The variable somestring (in line 1)is holding the string "really cool".
Line two just replaces the %s with whatever is in the variable.
The go in order. So if you had
sprintf("This is %s and I %s", somestring, anotherstring);
Okay CString. Basically CString is a class that provides support for manipulating strings.
According to MSDN: It is intended to replace and extend the functionality normally provided by the C run-time library string package.
One of the extended functions is the format function. CString is the base class and format is a finction under that class. format allows you to basically setup a string just like using sprintf, where you can use %s or other format variables.
Now I know the other programming guru's out there will complain that I totally did not follow prgramming speaking edict...but how cares just as long as you understand what's going on. I too hate it when these guys speak over my head and I try to keep it at my or some other programmers level so that theres an understanding.
Hope this helps
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
ok THANK YOU SO MUCH Tom, but i have only one more prob...how do u declair the sprintf("... i am getign this error..
--------------------Configuration: netsent - Win32 Debug--------------------
Compiling...
netsent.cpp
C:\Documents and Settings\Carter\My Documents\C++ Files\netsent.cpp(16) : error C2065: 'sprintf' : undeclared identifier
Error executing cl.exe.
netsent.exe - 1 error(s), 0 warning(s)
----------------------------------------------------------------------------
thanks..
~carter
|
|
|
|
|
Add following files to your stdafx.h:
#include <stdlib.h>
#include <conio.h>
A. Riazi
|
|
|
|
|
ok i added those libraries ... also i added "stdafx.h" but got this error when compiling...
--------------------Configuration: netsent - Win32 Debug--------------------
Compiling...
netsent.cpp
c:\documents and settings\carter\my documents\c++ files\netsent.cpp(1) : fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory
Error executing cl.exe.
netsent.exe - 1 error(s), 0 warning(s)
here is my source..
#include "stdafx.h"
#include <windows.h>
#include <iostream.h>
#include <conio.h>
#include <stdlib.h>
int main()
{
char user[20], message[1000];
char szFullMessage[256] = {0};
cout << "User/IP = ";
cin >> user;
cout << "Message = ";
cin >> message;
sprintf(szFullMessage, "net send %s %s", user, message );
system(szFullMessage);
return 0;
}
|
|
|
|
|
do anyone know the how to write code for rotating & mirror objects drawn in mfc? instead of drawing them again and again for each rotation.
e.x.
OnDraw()
{
//shape 1
draw the shape 1
//shape2
draw shape 2
//shape3
draw shape3
}
rotate()
{
//rotate shape 1, 45o degrees
//again rotate shape 1
//again rotate shape 1 etc...
}
Is there a code that do this rotating?(example-CRect, which draw the rectangle) something similar to this..
even if not just let me know...
thanks
shanila
|
|
|
|
|
How to add bar containing icons for commonly-used folders, such as My Computer, Favorites and Desktop in my CFileDialog?
|
|
|
|
|
hi
I don't know how to set icons in CFileDialog.But you can do this using Microsoft Common Dialog controls.
1. Go to Project-->Add to Project-->Components and Control.
2. Choose Registered Activex Controls and select Microsoft Common Dialog Control Version 6.0.
3. Insert this component.(The control will now appear in your tool box.)
4. Place the control in your dialog.
5. Add a member variable for this control.
6. Call the ShowOpen() method.
I hope it's OK for you
Mahesh Varma
|
|
|
|
|
|
hi, i'm looking for a routine to convert double to string with at least a precision as the windows calculator does(32 digits after the comma)!
does someone know such a function??
thx 4 help,
IceMatrix
|
|
|
|
|
try this:
double dFoo = 41.1325934653849974801841984193481498319048193849
char string[256];
sprintf("%d.32", dFoo);
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
small correction of last line
<br />
sprintf(string,"%f", dFoo);<br />
|
|
|
|
|
|
Anna-Jayne Metcalfe wrote:
If you need more than that, you're going to have to roll your own.
I didn't think you smoked
The tigress is here
|
|
|
|
|
Only in the event of fire, fudge or extreme drunkeness.
Anna
Homepage | My life in tears
"Be yourself - not what others think you should be"
- Marcia Graesch
"Anna's just a sexy-looking lesbian tart"
- A friend, trying to wind me up. It didn't work.
Trouble with resource IDs? Try the Resource ID Organiser Visual C++ Add-In
|
|
|
|
|
but how does the windows calc do it?
IceMatrix
|
|
|
|
|
It probably uses a custom datatype or a third party library containing one.
Do a search on the web and you should find something suited to your needs. It may not, however, be free.
Anna
Homepage | My life in tears
"Be yourself - not what others think you should be"
- Marcia Graesch
"Anna's just a sexy-looking lesbian tart"
- A friend, trying to wind me up. It didn't work.
Trouble with resource IDs? Try the Resource ID Organiser Visual C++ Add-In
|
|
|
|
|
float f;
double d;
f = 3.1415926535897932384626433832795f;
d = 3.1415926535897932384626433832795;
printf( "%.32f\n", f );
printf( "%.32lf\n", d );
Output:
3.14159274101257320000000000000000
3.14159265358979310000000000000000
double has to be more precise, but the function doesnt show it!
|
|
|
|
|
I am looking for a way to get Windows to notify my application when a new USB device is attached or detached from the system.
The ideal solution would be a callback method of some kind, but a small low overhead polling loop could also work.
Thank you.
|
|
|
|
|
Windows sends a (rather, a few) WM_DEVICECHANGE message to all top level windows when *anything* in the device list changes.
You can also register for notifications for a specific device class, usign RegisterDeviceNotification()
Note: There's a bug in Win98 that makes UnregisterDeviceNotification crash.
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
Can this be done? I tried it and got assertion errors.
-- Steve
|
|
|
|
|
Maybe this will help you
http://www.codeproject.com/dialog/CDialogEx.asp
sledge
|
|
|
|
|
Hi,
I have a doubt. Please help me.
Myprogram.exe opens a text file in network with CFile::modeReadWrite | CFile::shareDenyWrite flag. Another instance of Myprogram.exe from another computer try to open the same file with CFile::modeReadWrite | CFile::shareDenyWrite flag at the same time. I would like to give the second Instance only read permission and show him the network ID of the person who has opened this file for writing.
How will I achieve it?
Thanking You
Kindi
|
|
|
|
|
Well, the first thing is easy. Just try to open the file with write access and if it fails, try open it again using only the read parameter (Use CFile::Open, not the constructor). The second thing with the network ID is a bit harder and depends on your file server.
Isn't it CVS what you want?
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|