|
|
Hi, i want to split a line from a text file which i don't know it's length just i know that line has this format:
Welcom:2004-9-5:4 :1:23
but the numbers can be one digit or 2 and that is why i don't know the length. i will just parse line and will read it.
will appreciate any help, specially with few lines of code
really thank you
|
|
|
|
|
One way is with AfxExtractSubString() . Another is with strtok() .
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
thanks but can you explain more (alittle bit )
really thank you
|
|
|
|
|
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_strtok.2c_.wcstok.2c_._mbstok.asp
http://support.microsoft.com/default.aspx?scid=kb;en-us;200421
http://www.codeproject.com/string/split_cstring.asp?df=100&forumid=14815&exp=0&select=442099
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
thank you for information but my problem is that i have the file with more than 100 lines and i have to read and seprate each line with delim.
I can read each line and save it in string ptr but how to check it with a char ",".
really thank you
|
|
|
|
|
Oriocat wrote:
...but my problem is that i have the file with more than 100 lines...
It matters not if you are processing 10 lines or 10,000 lines, both of the functions I suggested can be used. After each line is read, simply call one of the functions the appropriate number of times.
BTW, is this an MFC application?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
VC++.net
then if my line is pointer of string still those functions will work?
really thank you
|
|
|
|
|
Oriocat wrote:
VC++.net
Which has no bearing on whether it is an MFC application or not. If it is, AfxExtractSubString() can be used, whereas strtok() cna be used in either case.
Oriocat wrote:
then if my line is pointer of string still those functions will work?
That depends on what "pointer of string" is.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
what i have for getting the line is:
StreamReader* sr = new StreamReader("file.txt");
String *L = ""; //for putting each line on it
L = sr->ReadLine();
// and then i will use ArrayList to save each line
// with while loop i read line by line
now my question is how should i use L in that function?
thank you
|
|
|
|
|
I've not ever used a String object, but a cursory glance shows me it has no methods for accessing the internal object (much like the LPCTSTR operator of CString ).
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
String *L = ""; //for putting each line on it
what data type is String?
you are creating a pointer to an object and assigning it a value. I dont think this will work. Mabey it should be like this
String L = "";
if this data type is really stl::string then you can call c_str() to get a const char ptr and pass that to strtok
|
|
|
|
|
i created a doc/view app without using the wizard.the problem i am having is that the child windows don't display any title at all. the shared resource string is ok - i substituted it in a Wizard generated app. and it works fine there. my app handles ID_FILE_NEW and brings up a dialog on ID_FILE_OPEN.
do i have to include/or override something that i am overlooking ?
thanks
|
|
|
|
|
Hello...I'm a newbie in c++ win32 programming. I'm trying to create a bitmapped button in my dialog. The bitmap is already in my resource and I have checked the enable bitmap under the properties of the button.
What do i do next?
Pls help! thanks!
|
|
|
|
|
See if either of these two links are of any help:
http://flounder.com/bitmapbutton.htm
http://www.codeproject.com/buttonctrl/
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Here u go,
HANDLE hCalBmp = LoadBitmap( hInst , MAKEINTRESOURCE(IDB_BITMAP) ) ;
SendMessage( GetDlgItem( hDlg, IDC_CALIBRATE ), BM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)hCalBmp ) ;
Try this in INITDIALOG.
Hope this helps.
|
|
|
|
|
I have a Windows 2003 Server (Standard) and Visual Studio 6.0 with Service Pack 6 installed.
I try to work on a MFC project, but every 15 minutes or so I get an error message box "MSDEV.EXE could not locate \device\harddisk\0" and the MSDEV is locked up
I can bring up task manager and kill the process, but this is affecting productivity
My hard drives are letered F: and G: instead of the traditional C: and D:
Is this the problem? Has anyone else seen this and worked around it?
Is it a 'tightened' security issue?
I am logged in as a member of the local administrators group.
I am pretty sure I installed the Visual Studio while logged in under this development account as well.
Thanks for any ideas
|
|
|
|
|
I had made ocx control in MFC which contain stock proerty page (color and font). My problem is to move system color combo box of color property page to other place in same page. how i can do this
suggest me
Thanks in advance
Ajit Pratap Singh
|
|
|
|
|
Hi,
I'm working on an installer file. I want it install (among other things) some drivers for a usb device i have. The driver consists of three files: zanthic_c4u_W2K.inf, ezusb.sys, C4ULoad1W2K.sys. I can get the windows to load the drivers correctly, but only if I manually specify where each file is when windows discovers the device. I want the device to simply install "no questions asked". I found that the .sys files end up in c:\windows\system32\drivers and the .inf files end up in c:\windows\inf when I install the hardware by hand, but if I set my installer to copy the files to these directories, windows says "i can't find them, please tell me where they are". Can anyone tell me where/how I should put these files to let windows plug n' play auto locate them?
Joel Holdsworth
|
|
|
|
|
It depends. If you are using Windows 2000 or XP, and your driver is certified, you can do it this way.
Copy all the files into a semi-permenant area on the hard drive, such as Program Files\yourProgram\Drivers. Make sure the directory structure you create matches exactly what your INF says (typically, all files are in the same dir as the INF.)
Then call SetupCopyOemInf for your INF, and give it the path on the hard drive.
If you are not certified, you cannot get around the uncertified driver warning screen, unless you inform your users to go into their system settings and disable checking for certified drivers.
If you are dealing with Windows 98/Me, then I pity you.
"Fish and guests stink in three days." - Benjamin Franlkin
|
|
|
|
|
Hmm ok, that makes sense, but I'm having problems because I'm using inno setup which doesn't appear to have direct support for this - I can only really get at the command line, unless I start making mini installers to do the job. Is there any way of doing it simply through the command line?
Joel Holdsworth
|
|
|
|
|
No. What you can do is write a test EXE that does nothing but call SetupCopyOemInf with, say, the INF you specify on the command line. (Added bonus, you can manually copy files, then call your EXE directly to make sure it is working independent of anything else before you put it into the whole setup.)
There may be ways of hacking the registry to do this, too, but I would strongly recommend against doing that.
Unfortunately, installation of drivers is something very poorly supported by setup applications, so writing little custom utilities like this is pretty much all you can do.
"Fish and guests stink in three days." - Benjamin Franlkin
|
|
|
|
|
Thanks for that - it worked like a charm!
Joel Holdsworth
|
|
|
|
|
I'm trying to use the COM viewer to get ProgID's for controls and use them, but I'm doing something wrong. The CreateDispatch works fine for a control (in this case, the Thumbnail viewer), and I can even call the methods, but I don't know how to draw an instance of the control on my form. Can anyone help?? Thanks in advance.
If it's broken, I probably did it
bdiamond
|
|
|
|
|
Hi, I've got this problem when developing my first DLL:
I have a DLL with an Interface class. I also have an application that calls some functions from the Interface class.
In the application there exist a function that I want to be called from the DLL (as a callback), so I pass a function pointer to the DLL.
I want to store the function pointer inside the DLL so I can call the function whenever I want, for this reason I have created an struct in which I store the function pointer and some other things. Until here, everything fine...
The problem comes when doing an instance of the struct; if I do that instance inside the Interface class (as a member) I cannot copy the function pointer in it; but if I do the instance outside any class (that is as "global") then there is no problem when copying the functon pointer.
Does anybody knows why can this happen?, it can be a problem of memory access?
Here is a "meta-language" example:
DLL:
In Interface.h:
typedef struct
{
functionpointer
}MyStruct;
class Interface
{
Interface ();
MyStruct mystruct;
void FillStruct (function_pointer_from_outside); //this is the exported function
}
In Interface.cpp
void Interface::FillStruct(function_pointer_from_outside)
{
mystruct.functionpointer = function_pointer_from_outside; //THIS GIVES EXECUTION PROBLEM
}
On the other hand if I make something like this, it works:
In Interface.h:
typedef struct
{
functionpointer
}MyStruct;
class Interface
{
Interface ();
void FillStruct (function_pointer_from_outside);
}
In Interface.cpp
MyStruct mystruct; //Instance as "global"!!!!!
void Interface::FillStruct(function_pointer_from_outside)
{
mystruct.functionpointer = function_pointer_from_outside; //OK!!!
}
HELP!!
|
|
|
|