...but how can i acces argv to get D as a command line argument?
The same way you would access parameters from within any other function. main() is no different. See here for more.
Member 14956475 wrote:
...is it possible to use srand command?
Your code is already doing that. However, the way in which you are using it is meaningless since you are also not calling rand(). rand() by itself will always generate the same sequence of numbers. srand() will "seed" the number generation process to start at a different spot.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
It's working but i have one issue that i can't still solve , i need to put a maximal limit of the generated numbers at input , can anyone give me a clue how i can set x[i] a limit? I only found how to put a limit at rand but when it multiplies with function of BBS it exceeds the limit
I have a Win32 application written in C and compiled by MS Visual Studio 2017 Community Edition.
My application has no problem to print on a dot matrix printer.
But, it has problem when trying to print on Inkjet printer.
My application fails to select a font type, change the font size or condensed through printer Escape character (Epson).
Could you please help?
Font selection, font size and condensed printing work with dot matrix printer that support Esc/P.
Unpredictable problems occur when trying to print on Inkjet printers such as:
1. The printer ignores the font type, font size and condensed printing.
2. Both Epson WF-7611 and HP OfficeJet Pro do not accept "RAW" for the data type in "StartDocPrinter" parameter. Epson WF-7611 will only accept "Text", while HP OfficeJet Pro only accept "XPS_XPSS". This means I have to detect what printer to print before assigning the data type.
3. The Win32 Printing API says that calling "EndPagePrinter" will end the current page, but it doesn't work that way.
I did try to use PCL6 but fail.
I send the PCL command by calling WritePrinter API.
I do not know if I need to call another Win32 Printing API to send the PCL command.
The PCL command is arranged in an array of bytes. But, no response from the printer.
Any code sample to send PCL command, please?
Just a suggestion if you get really desperate; If the printer has a hex dump mode feature you can enable it and print out exactly what's being sent to the printer. Another way is to set the printer driver to 'Print to File' and your job will print to a file. Then if you are familiar with the printer language, you can examine the data to see if something has been added or missing in the printer data stream.
I found some old code that I wrote some time ago but never tested. I did a quick test with it and found that when I printed to my hp laserjet that I was only getting 1/2 of the data. After a little investigating I found that i didn't adjust for unicode data so using "RAW" mode passing 2 * datasize to
seem to fix the problem. However, as I said, this code is not fully tested so don't know if this is a real fix or if it has anything to do with your problem. I have problem using "TEXT" mode also but don't feel like investigating. The documentation just says "size of the array". Doesn't mention anything about unicode.
Test data _T("abcd")
Sending a size of 4 resulted in "ab" printing out.
Sending a size of 8 resulted in "abcd" printing out.
Also, if your printer data escape sequence as nul values in it, you may have to adjust it for unicode; ie. double nul.
_T("escN") + nul + nul