|
CRLF
CR = Carriage Return
LF = Line feed
some old printers did CR automatically after LF , some not. And that's where all that started AFAIK.
In windows the texts usually uses CRLF and only VC (and other so designed utilities) are able to display texts with LF only (notepad not for example).
But linux guys tries to save this byte (CR ) therefore for linux the 'native' is to do only LF .
Conversion API - hmm replace?
Designing application - take the LF as the controlling sequence and ignore the CR before LF , this will allow your app to open both styles of texts. You have only to take a special care while saving.
|
|
|
|
|
There's no 'correct' way. Text files on Windows generally have the CRLF, whilst on Unix and Mac it has LF. I say generally because its not a requirement and you can mix and match, provided your application knows how to handle it. If you want to produce a text file that you can open in Notepad then you should go the CRLF way.
Opening a file in 'text mode' should do the conversion for you. I also think it will expand a \n into a \r\n combination, when writing (using the stdio functions anyway).
|
|
|
|
|
Generally, these are the standards:- DOS/Windows = CRLF
- Unix = LF only
- Mac = CR only (not LF only)
There are no apis to do automatic conversions, but you can use simple string search/replace's to do it.
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi Guys,
I am new to MFC. I want to detect which icons are selected or not on desktop. Any body can help me?
Thanks
Tipu
|
|
|
|
|
I have a bit of a problem.
I have a string of characters, let's say for example, "0A74"
I want to take two of the characters at a time (i can do that much) and convert them to their ascii equivalent.
so, basically, if i were to input "0A74" i would like to have "\nt" as my output. are there any built-in base conversion functions i can use to do this?
I still need to do processing on the resulting string (that is, "\nt") so streams won't really be very efficient for me... any way to do this striclty with built-in functions and variables?
|
|
|
|
|
strtoul() is your friend here.
CString Convert(CString input)
{
CString output;
char *dummy = NULL;
int pos = 0;
int len = input.GetLength();
while (pos < len)
{
Output += (char)strtoul(input.Mid(pos, 2), &dummy, 16);
pos += 2;
}
return output;
}
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Wasn't aware that function existed -- you're a Godsend. thanks.
|
|
|
|
|
|
Hi Ravi,
Nope, interesting though. Can't think of where I'd use it though.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Hi everyone,
I want to be notified when a file is created in a folder. I use FindFirstChangeNotification(....) and listen for the FILE_NOTIFY_CHANGE_FILE_NAME event. However, it fires this event for rename and delete also. How can I know that a file has been newly created.
Thanks,
Xargon
Without struggle, there is no progress
|
|
|
|
|
Ok,
I found out the ReadDirectorzChangesW(...) function and it seems to be exactly what I am looking for on platforms >= WinNT. Any idea of something that might work on Win98 platforms.
Thanks,
Pankaj
|
|
|
|
|
It's definately possible and quite easy with FindFirstChangeNotification/FindNextChangeNotification.
Chris Richardson
|
|
|
|
|
Hi, I am new to c++ and I was put in a tough computer programming class and was absent the first two days and I would really appreciate it if somebody could help me:My E-mail address is squee211@yahoo.com Could you please E-mail me the code needed to run these programs. Thank you. If you need anything at all in return I would be more than happy to do it.
Here are the questions:
Run a program that will ask the user for a floating point number. It should then display the result of dividing that number by two in this format:
Example: Enter a number: 24.6
24.6 divided by two is 12.3
Run a program that will ask the user for three integers. It should then display the sum of the integers in this format:
Example: Enter an integer: 8
Enter another integer: 2
Enter another integer: 3
8+2+3=13
Run a program that will ask the user for two floating point numbers. The second number asked for should be the percentage the user wants to find of the first number. It shouls then display the result of finding the percentage in this format:
Example: Enter a number: 25
What percent of 25 would you like to find? 3
3% of 25 is 0.75
Run a program that will ask the user for a number of eggs. It should then display how many dozens exist and how many eggs are left over in this format:
Example: Enter a number of eggs: 45
45 eggs are 3 dozen eggs with 9 eggs left over.
Run a program that will ask the user for three numbers. It should then display the average of the numbers in this format:
Example: Enter a number: 3
Enter another number: 5
Enter another number: 8
The average of the three numbers is 5.333333
Run a program that will ask the user for a number of items. It should then display how many containers must be used to hold the given number of items. Assume each container holds 25items. The answer should be displayed in this format:
Example: Enter a number: 52
52 items requires the use of 3 containers.
Run a program that will ask the user for an amount in cents ($1.23=123 cents)
It should then display the number of quarters, dimes, nickels, and pennies equal to the amount.
|
|
|
|
|
Go and find all these tasks. Eliminate the first word in each task. Replace the eliminated word with "Design, implement and test, all by yourself, ...".
Perform these tasks. When ready, somebody here might be willing to fulfill your request and run these programs.
Bernd
|
|
|
|
|
I'll help you out with one of these programs, but you really should go to class if you expect to learn this. And I didn't check to see if this compiles.
Run a program that will ask the user for a number of eggs. It should then display how many dozens exist and how many eggs are left over in this format:
Example: Enter a number of eggs: 45
45 eggs are 3 dozen eggs with 9 eggs left over.
<code>
#include <iostream>
using namespace std;
int main()
{
int Eggs;
cout << "Enter a number of eggs: ";
cin >> Eggs;
cout << Eggs << " eggs are " << Eggs / 12 << " dozen eggs with "
<< Eggs % 12 << " eggs left over.\n";
return 1;
}
</code>
Douglas A. Wright
dawrigh3@kent.edu
|
|
|
|
|
"/r" is not an escape, but '\r' is.
|
|
|
|
|
I have an application that captures digital video and all is well with my world. The problem is that I have had a request to have the capture of the audio be user controllable (always capture video). I took my existing filter graph and disconnected the audio output pin from the DV Splitter so that only the video was input to the AVIMux and then out to the file.
Running the graph via GraphEdit produces the desired results but when I run it programatically I get the first frame of the capture repeated for the entire duration of the capture almost like the video data is not being pushed through the filter graph.
Does anyone have any ideas on this?
thanks in Advance
cje
|
|
|
|
|
Make sure that all the relevant pins are connected to a renderer. Try connecting the audio output pin to a null renderer.
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
I get the same effect...all frames in the resultant avi file are the same frame of video (the first one captured)
|
|
|
|
|
Hi.
I'm trying to override CMDIChildWnd::OnCreateClient in a mdi child window.
In that window i have a splitter window and one of the views is a CTreeView.
If at the beginning of my OnCreateClient i call parents (CMDIChildWnd) OnCreateClient my inner splitter is fixed (can't be moved) and the tree control is uneditable (can't select items), if i remove call to parents OnCreateClient i can move the splitter and edit (select items) from tree control,
and if i call at the end of my OnCreateClient to parents - i get an empty child.
I've tried figuring out why each change causes what it does, but didn't make it.
Any help will be appreciated.
Ori.
|
|
|
|
|
I'm trying to get some code working that was available at another site. Having difficulty identifying how to pass values to the following function.
void WnWd_CreateHWDrv(CWnd* pWnd ,
WORD wHWCardNo ,
BYTE* lpImage,
BITMAPINFO* lpDIBHdr)
{
CWnDrv* pThread;
pThread = new CWnDrv(pWnd,
wHWCardNo,
lpImage ,
lpDIBHdr);
if (pThread == NULL) return;
ASSERT_VALID(pThread);
// Create Thread in a suspended state so we can set the Priority
// before it starts getting away from us
if (!pThread->CreateThread(CREATE_SUSPENDED))
{
delete pThread;
return;
}
// since everything is successful, add the thread to our list
m_threadList.AddTail(pThread);
}
Are these standard values obtained from windows somewhere, or do I have to give them from an MFC dialouge application ? If I have to give them, where do I get them from in windows? The wHWCardNo is straight forward enough, thats zero or '0'. Does anyone know what form or value this should take ?
|
|
|
|
|
I need an efficient way to determine the name of a function from within the function itself, or possible the parent function (what’s down one level on the stack). Any ideas?
This is for an error logging system. I want to provide a way to make a log entry that identifies where in the source code the error occurs. Something similar to __LINE__ __FILE__, but not so bloated, would be great.
-Matt
|
|
|
|
|
Dunno about a way to tell the function name.
As far as identifying the file and line, one solution I've used is macros. In fact, it's probably the only solution. Something like this may do it:
#define RAISE_ERROR(description) \
do { \
CString strError; \
strError.Format("Error %s at %s(%d)", description, __FILE__, __LINE__); \
LogError(strError); \
throw CMyException(strError); \
} while (0)
Regards,
Alvaro
Hey! It compiles! Ship it.
|
|
|
|
|
Use the __FUNCTION__ macro in VS.NET
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
Andrew,
Thank you. I guess I will have to work on the move to VS.NET. Does the __FUNCTION__ macro return the class and function name? i.e. Box::GetSize() or just GetSize()?
Thank you,
Matt
|
|
|
|