|
I have a printer datafile in a remote computer. I want to print it in my local printer. It's encoded in pcl language, but it's too large to move it into my pc. How can I split large printer data files into multiple pages and print them continuously(one by one)
|
|
|
|
|
Hello
to all of u
i am using api DNSQUERY to get the version of database of main.cvd and daily.cvd files of clamav(antivirus) from current.cvd.clamav.net
i am getting the correct remote version but this api is not supported by windows 98 so please tell me any api or any other way how can i get the result on win 98 also
Thanks in advance
ankit
ankit
|
|
|
|
|
Hi all,
When any document is opened in ms word then it also creates .tmp file in same folder/temp folder. I want to stop such .tmp file creation.
How can i do that ? Can it be done by some option in MSWord settings? can it be done by writting addin DLL for that? or thru can it be done by writing COM,VC++ application ?
Please Let me know if it is possible? how? by which method?
Any suggestion are welcome.
Thank in advance.
Jetli
conclusion means Coming to wrong Decision with confidence
|
|
|
|
|
they're automatic recovery files.
go in the tool\options\file location
and either turn off automatic recovery or point it
to a different folder (it's a good feature, but
you may not want it in with your .doc files
because it crowds your directory
|
|
|
|
|
shaveyourhead wrote:
go in the tool\options\file location
and either turn off automatic recovery or point it
to a different folder
Yes u are right.
But Even if i uncheck those option, word still creates .tmp file.
Does anybody has point to this?
How to prevent word from creating ,tmp file, by any means (COM Addin, programmatically etc...)
Thanks
Jetli
conclusion means Coming to wrong Decision with confidence
|
|
|
|
|
See MSDN article Q211632.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I'm looking for multi-user server source code (tutorial) (C/C++, sockets, no MFC).
Oh, I already know how to do multi connections the windows way (messages sent to my window when data is received), but that's not what I want.
I know there are some here at codeproject but they all use MFC (yuck) and seem alot more complicated then what I've found so far.
I found the original at www.planet-source-code.com (I've re-done and simplified it for this post):
SOCKET ServerSocket;
SOCKADDR_IN server_address;
FD_SET masterSet;
HANDLE ThreadHandle;
DWORD ThreadID;
int RetVal = 0;
DWORD WINAPI acceptingThreadProcedure(LPVOID ServerSocket)
{
SOCKET* Socket = (SOCKET*)ServerSocket;
SOCKET ClientSocket;
while(1)
{
ClientSocket = accept(*Socket,0,0);
FD_SET(ClientSocket,&masterSet);
printf("Client on %d connected\n",ClientSocket);
}
return TRUE;
}
int InitServer()
{
WSADATA wsaData;
WSAStartup(MAKEWORD(1,0),&wsaData);
ServerSocket = socket(PF_INET,SOCK_STREAM,0);
server_address.sin_family = AF_INET;
server_address.sin_port = 4200;
server_address.sin_addr.s_addr = INADDR_ANY;
bind(ServerSocket,(SOCKADDR*)&server_address,sizeof(SOCKADDR_IN));
listen(ServerSocket,5);
ThreadHandle = CreateThread(NULL,0,acceptingThreadProcedure,&ServerSocket,0,&ThreadID);
Sleep(100);
FD_ZERO(&masterSet);
FD_SET pollingSet;
timeval waitTime;
waitTime.tv_sec = 0;
waitTime.tv_usec = 0;
SOCKET clientSocket;
unsigned long BufferSize;
while(1)
{
pollingSet = masterSet;
if(pollingSet.fd_count == 0)
continue;
RetVal = select(pollingSet.fd_count,&pollingSet,NULL,NULL,&waitTime);
if(RetVal == 0)
continue;
for(unsigned int i = 0; i < pollingSet.fd_count; i++)
{
clientSocket = pollingSet.fd_array[i];
recv(clientSocket,(LPSTR)&BufferSize,sizeof(BufferSize),0);
BufferSize = ntohl(BufferSize);
LPSTR Buffer = new char[BufferSize];
recv(clientSocket,(LPSTR)Buffer,BufferSize,0);
Buffer[BufferSize] = '\0';
printf("Client %d: %s\n",clientSocket,Buffer);
delete[] Buffer;
}
}
}
I've been looking for tutorials that teach it with FD_SET and select but havn't found anything yet.
Does anyone know of a good tutorial?
P.S. The reason I'm looking for something more than what I've found is that the current code (above) doesn't have a way to send data back, and I'm not sure how to add that. Also the code just doesn't seem right (tho I don't know what multi-user code looks like), and it uses 100% system resources.
Alright, thank you much.
|
|
|
|
|
Well if you don't like MFC, try this unix sample:
/*
* ClockServer.c
* sample Unix (SCO) clock server for pcsclock
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
/* network includes */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
/* PCS specific */
#include "token.h"
#include "unixser.h"
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#endif
/* the default port */
int Port = 9999;
// The socket
int Socket;
// The connection the child talks through
int NewConnection;
int SerialPort, Opened;
char Buf[BUFSIZ];
enum tagCOMMANDS
{
UNKNOWN = -1,
wOPEN,
wCLOSE
};
KEYWORDS KeyWords[]=
{
"open", 4,
// PCSClock sends 'CLOSE' just before it does so
"CLOSE", 5,
NULL, 0
};
/*
* Trim a string of spaces (Control characters remain)
*/
char *Trim(char *String)
{
int sLen;
if(String != (char *)NULL)
{
sLen = 0;
while(*(String + sLen) == ' ')
sLen++;
if(sLen)
strcpy(String, String + sLen);
if((sLen = strlen(String)) > 0)
{
while(sLen && *(String + sLen - 1) == ' ')
{
*(String + sLen - 1) = 0;
sLen--;
}
}
}
return(String);
}
int InterpCommand(char *Buf)
{
char *cp = Buf;
char Token[128];
if(GetToken(&cp, Token) != FINISHED)
{
switch(IsReservedVar(Token, KeyWords))
{
case wOPEN:
if(!Opened)
{
fprintf(stderr, "Opening %s\n", cp);
SerialPort = ComOpen(Trim(cp), 256, 256);
if(SerialPort >= 0)
{
if(ComSetParams(SerialPort, 9600, NONE, 8, 1, NONE) == OK)
{
write(NewConnection, "OK", 2);
Opened = TRUE;
}
}
if(!Opened)
{
write(NewConnection, "Fail", 4);
perror("Open port failed");
}
}
break;
case wCLOSE:
if(Opened)
ComClose(SerialPort);
Opened = FALSE;
return(FALSE);
default:
fprintf(stderr, "unknown command %s\n", Buf);
break;
}
}
return(TRUE);
}
int main(int argc, char **argv)
{
struct sockaddr_in Sock_IN;
if(argc == 2)
{
int Tmp;
Tmp = atoi(argv[1]);
if(Tmp > 0)
Port = Tmp;
}
if((Socket = socket(AF_INET, SOCK_STREAM, 0)) == -1)
{
perror("socket() failed");
exit(1);
}
memset(&Sock_IN, 0, sizeof(Sock_IN));
Sock_IN.sin_family = AF_INET;
Sock_IN.sin_port = htons(Port);
Sock_IN.sin_addr.s_addr = htonl(INADDR_ANY);
if(bind(Socket, (struct sockaddr *)&Sock_IN, sizeof(Sock_IN)) == -1)
{
perror("bind() failed");
exit(1);
}
if(listen(Socket, 5) == -1)
{
perror("listen() failed");
exit(1);
}
while(TRUE)
{
int Pid;
fprintf(stderr, "Accepting");
if((NewConnection = accept(Socket, 0, 0)) == -1)
{
perror("accept() failed");
exit(1);
}
/* Start a new child */
if((Pid = fork()) == -1)
{
perror("fork() failed");
exit(1);
}
if(Pid == 0)
{
int FirstTime = TRUE;
Opened = FALSE;
SerialPort = -1;
Pid = getpid();
while(TRUE)
{
int Count;
*Buf = 0;
if((Count = read(NewConnection, Buf, sizeof(Buf))) == -1)
{
perror("read() failed");
exit(1);
}
if(!Count)
break;
Buf[Count] = 0;
fprintf(stderr, "%d Read: %s\n", Pid, Buf);
/* Clock commands always begin with '>' */
if(*Buf == '>')
{
if(Opened)
{
clock_t Tick;
char *cp;
char SerBuf[BUFSIZ];
if(write(SerialPort, Buf, Count) < 0)
perror("Write serial port failed");
// Don't know why but on this stupid SCO machine
// the io seems so slow that we now have to wait
// for serial output to complete
sleep(1);
cp = SerBuf;
*cp = 0;
Tick = clock();
while(clock() - Tick < 3000)
{
if(read(SerialPort, cp, 1) == 1)
{
cp++;
*cp = 0;
/* Clock replies always end in <CR> */
if(*(cp - 1) == '\r')
{
Count = strlen(SerBuf);
if(send(NewConnection, SerBuf, Count, 0) != Count)
perror("send failed");
fprintf(stderr, "%d Sending %s\n", Pid, SerBuf);
break;
}
Tick = clock();
}
}
}
else
perror("No open received");
}
else if(*Buf)
if(!InterpCommand(Buf))
break;
}
close(NewConnection);
fprintf(stderr, "%d child dying", Pid);
exit(0);
}
/* Close the parent's connection */
close(NewConnection);
}
}
|
|
|
|
|
if I want to export a global operator+ overload, like
String operator+( const String& lhs, const int& rhs );
If I define this in a header, like
__declspec( dllexport ) String operator+( const String& lhs, const int& rhs );
and then implement this in a .cpp like
__declspec( dllexport ) String operator+( const String& lhs, const int& rhs )
{
return ....
}
it compiles and builds the DLL fine. When I link to the dll from an exe, however, I get linker errors claiming "String operator+(..." isn't defined.
What am I doing wrong? Is it not possible to have the implementation in a .cpp file?
Thanks !
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
May that be a problem of linker decoration, calling convention mismatch? Could using extern "C" solve your problem?
Fold With Us!
Sie wollen mein Herz am rechten Fleck, doch
Seh' ich dann nach unten weg
Da schlägt es links
|
|
|
|
|
Well I did try the "extern" keyword and that didn't make any difference. I'm really at a loss, and I guess I'll just have to try and put the impl in the header, which I really didn't want to have to do.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
Is the __declspec( dllexport ) hard coded in the header?
If so you might try forward declaring the prototype with
dllimport and try that.
Thank You
Bo Hunter
|
|
|
|
|
nope, I am using the traditional DLL_API kind of macro to shift it to import or export as the case may be.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
How to include a .lib file in a activex control project?
I want to create a ocx project which uses some dll and lib file.
There is not link option in project menu.
How to do it?
Thanks!
|
|
|
|
|
char myOldFileName[99];
char myNewFileName[99];
myOldFileName = "myfilename.sch"
Here's what I need to do:
I take myOldFileName which = "myfilename.sch"
and set myNewFileName = "myfilename.cfm"
then I need to take myNewFileName and set it = to myfilerocks.cfm
the problem is I get little smiley face characters when I do it
so it becomes myfilenamerocks .cfm (not really that smiley face, the ascii one).
I'm using Visual c++ 4.2.
|
|
|
|
|
you can't assign stuff like that in C/C++;
try using either strcpy (bad, IMHO), or std::string (good). If you use std::string, it becomes:
#include <string>
std::string myOldFileName;
std::string myNewFileName;
myOldFileName = "myfilename.sch"
myNewFileName = "myfilename.cfm"
if Visual c++ 4.2 doesn't support STL (I have no idea if it does, though I'd love to know why you are stuck using it ), then you'll need to use strcpy (or even memcpy).
Cheers
Jim
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
Jim,
the problem is 4.2 doesn't use strings. (as far as I can tell anyway)
I used strncpy to set mynewfilename = myoldfilename,
the problem I'm having is then manipulating mynewfilename.
I know in newer versions I can do an object.replace(...) but not on 4.2
I've broken it down by position number (ex: myoldfilename[x]) but that's where I start getting the smiley faces for some, but not all, of the characters.
----------------
why are we still on 4.2? because years ago someone decided it would be
too much work to upgrade to a newer version. Since then it's never been a priority. Luckily, that's about to change. In fact, I've got .net training next week and with any luck will soon leave 4.2 behind.
|
|
|
|
|
shaveyourhead wrote:
n fact, I've got .net training next week and with any luck will soon leave 4.2 behind.
Cool. Well if after that you still do C++, I can't emphasize enough how worthwhile it would be to replace this kind of code with std::string (or std::wstring if you need wchar_t support). It's just much less hassle and looks cleaner too.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
I got it figured out.
null terminated string was the cause
needed to set mystring[x] = 0;
and voila! no more smiley faces on the screen.
Just a big smiley face on me.
|
|
|
|
|
I really need some help with this one. I am new to the computer world, I am a college student and I am currently taking a course that covers object oriented programming. I needed help in trying to figure out how to start it. If anyone reads this please help me. Thank you for taking the time to read this. Below I have provided the criteria for doing the assignment and see if anyone may know how to do it, because I DON'T!!!.
Objectives:
You are to write a program that simulates the operation of a calculator. The calculator will perform the simple arithmetic operation of add, subtract, multiply, and divide. The user will be allowed to invoke methods to get data from the user (i.e., the operands), perform a given type of calculation, and to display the result.
Specific Instructions:
1. Define the class -- Calculator
a) Data members: Operand1, Operand2, and Answer -- all of type float.
b) Methods: Constructor, GetData, Add, Subtract, Multiply, Divide, and ShowAnswer -- all void return types.
c) Data members should be private, but all methods should be public
2. Constructor -- Calculator
a) The constructor should provide for two arguments of type float: Op1, and Op2
b) Give default values of zero to Op1, and 1 to Op2 in case the user passes no arguments when objects are created.
c) The constructor should assign the values of Op1 and Op2 to Operand1 and Operand2, respectively.
3. Each method that does a calculation should store the answer in Answer but not do any output itself.
4. The ShowAnswer method is responsible for displaying the calculated result of the last calculation.
5. Create four objects, Problem1, Problem2, Problem3, and Problem4 as follows:
Calculator Problem1(3,7), Problem2(8,3), Problem3, Problem4(17,5);
6. Do the following method calls: (YOU MUST FOLLOW THESE INSTRUCTIONS!)
a) For Problem1, call the method that will add the default values, and call the method to display the result.
b) For Problem2, call the method that will subtract the default values, and call the method to display the result.
c) For Problem3, call the method to get data, provide values of 7 and 3, multiply them, and display results.
d) For Problem4, call the method that will divide the first operand by the second, and display the results.
Jonathan
|
|
|
|
|
You're getting a 1 vote because this isn't the place to post homework assignments. Grow up, grab yourself buy the balls, get some hair on your chest, and make a good faith effort to do the work *first*, then come back and ask *specific* questions, *after* you have made the effort to try and learn/solve the problem. Otherwise sod off.
Cheers and have a nice day!
Ooh and remember, chocolate milk is good for you, Reading is actually helpful, and Google is your friend.
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
Mr. Crafton, I was not trying to pass of my homework on anybody, I was simply asking for someone to help me with a starting point. The reason that I am taking this course because it was one of the few that was left, I had to register late for classes due to a outstanding balance, that until recently I could even pay for. If I knew what to do even after reading the chapter, which I did, I wouldn't have asked for help. I tried to start it and it was completely wrong, the assignment is one that I have yet to even do in my previous computer classes. Therefore, I would appreciate that you not post something like that under my message, when I am trying to find someone to help me, if you have no suggestions please don't bother posting.
And you too have a nice day.
Jonathan
|
|
|
|
|
Don't get so uptight, Jonathon. Folks post homework questions here at least once per week. Sometimes they are well received, other times they are not. Several factors are involved.
Like most, I do not mind helping, but I need a show of good faith that you are actually doing the work and only asking for help when you are stuck. It helps no one for a homework assignment to be posted verbatim and ask others to do it for you.
Are others in your class having like difficulties? Does the instructor favor going to him/her for "getting starting" questions such as yours?
A much better approach is to take your assigmnent, break it up into smaller pieces and ask for help with those individually, perhaps even rewording the text so that it longer resembles homework. This is much better than trying to get help for the assignment as a whole, which will either get you ignored or flamed.
DHAPPREP wrote:
I tried to start it and it was completely wrong...
Show us what you have and we can critique it.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
You got flamed, that's normal because no one likes to answer yet another homework question.
I will though, give you some hints to start of...
1. Define the class -- Calculator -> see your book, if you can't do this, don't even start.
a) Data members: Operand1, Operand2, and Answer -- all of type float. -> create three variables of type float, that should be do-able
b) Methods: Constructor, GetData, Add, Subtract, Multiply, Divide, and ShowAnswer -- all void return types. -> actually, C++ consists of functions, but anyway, a function does something with your variables. The constructor normally initializes your variables, I suspect GetData will analyze the input. (take in input, put the first number in operand1, the second in operand two and decide if you have to add/substract/... [EDIT]Reading further I see this is not the case, I have no idea what it should do[/EDIT]
c) Data members should be private, but all methods should be public -> who-ever tells you all functions should be public is a moron. Only make public those things that you want other classes to see. Constructor, GetData, Add, Subtract, Multiply, Divide, and ShowAnswer are good to make public in this case.
2. Constructor -- Calculator
a) The constructor should provide for two arguments of type float: Op1, and Op2
public Calculater(float Op1 = 0, float Op2 = 0){ ... }
b) Give default values of zero to Op1, and 1 to Op2 in case the user passes no arguments when objects are created. -> see a)
c) The constructor should assign the values of Op1 and Op2 to Operand1 and Operand2, respectively.-> I hope you can do this
3. Each method that does a calculation should store the answer in Answer but not do any output itself. Answer = Operand1 +,-,* or / Operand2
4. The ShowAnswer method is responsible for displaying the calculated result of the last calculation. -> that would be something like cout >> Answer= >> endl; // make it nicer then this
5. Create four objects, Problem1, Problem2, Problem3, and Problem4 as follows:
Calculator Problem1(3,7), Problem2(8,3), Problem3, Problem4(17,5);
->this will create your Object
6. Do the following method calls: (YOU MUST FOLLOW THESE INSTRUCTIONS!)
a) For Problem1, call the method that will add the default values, and call the method to display the result. Problem1.Add(); Problem1.ShowAnswer();
b) For Problem2, call the method that will subtract the default values, and call the method to display the result. -> cf a)
c) For Problem3, call the method to get data, provide values of 7 and 3, multiply them, and display results.-> cf a)
d) For Problem4, call the method that will divide the first operand by the second, and display the results.-> cf a)
You're extremely lucky I'm bored for the moment .
So: define your class, with all the functions, then call the class from your main.
If you succed, you can always try to input the numbers yourself, making an interactive calculator.
good luck.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
V. wrote:
actually, C++ consists of functions...
True, but when they belong to a class, they are called methods.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|