|
Raza5680 wrote: Due to large number of elements one line of data spans two or more lines of a
text file.
So there are embedded CR/LF characters in some lines, or are you viewing it via something like Notepad that is wrapping long lines for you?
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Why not check the End Of Line( "\n" ) for each line and then get the first data of each line. You may have to use a while loop for this.
Every new day is another chance to change your life.
|
|
|
|
|
when the data is organized in lines, and hence newline characters have special meaning, I find it easiest to read the data one line at the time. In C fgetline() usually does that for me. Once you have an individual line in your hands, you can scanf() it to your heart's content.
|
|
|
|
|
|
tanks
i try to use WS_TABSTOP , not effect anything
modified 15-Jan-12 12:13pm.
|
|
|
|
|
Please try providing a bit more information about your problem, otherwise none will be able to help you.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
It will happen automatically for controls on a modal dialog box that have the WS_TABSTOP style. For other windows use the IsDialogMessage[^] function.
Steve
|
|
|
|
|
|
|
Please give more detail of your problem, this question is not clear.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Im trying to read a file, containing Strings n integers..
please help me to only to read the integers and find the total marks
file contain 10 students names and marks ,each in a line and students name and marks separated by a comma .
eg:
John,89
Katharin,78
F.R.Majeed
|
|
|
|
|
This sounds like a course assignment...
Think about it logically:
x - Find a way to read the file line by line
x - What could you do when you obtain a line?
x - Is there a way to split the line apart, maybe separate name and mark?
x - When you find a way to separate them, it is simply the case of casting the string to an int and visa versa.
If you get really stuck here is a nice link of tools you could use to help with the string:
http://www.cplusplus.com/reference/string/string/[^]
|
|
|
|
|
venomation wrote: it is simply the case of casting the string to an int and visa versa.
You cannot cast a string to an int , it must be converted.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
@ venomation what u mention above could be done through oop language but i want to know how to do it through C (sop)
|
|
|
|
|
Doing this with C language programming is not difficult; just a few statements.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Have you considered fscanf() ?
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
fp=fopen("SDetails.txt","r+");
while(1)
{
ch=fgetc(fp);
if(ch==EOF)
break;
fscanf(fp, "%d", &myInt);
printf(" %d ",myInt);
sum=sum+myInt;
}
printf("%d",sum);
fclose(fp);
what i did was like above ..but it print the same int 3 times ..i cant find the error...please help
now i can read only ints from the file..thx
|
|
|
|
|
What you have will never work as you expect. The call to fgetc() is going to advance the file pointer, then fscanf() is going to be reading from the middle of some byte. Have you checked the return value from fscanf() ? If it does not find a number to read from the file, it may be retaining the last read value.
Is your file laid out something like:
Name1,288,7099,441
Name2,1500
Name3,587,208
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
and not when i create the window .
thanks
i found what i need is call WS_DISABLED
but how i set this parameter on a button.again not when i create this window but after
nevermind i just create the window again when i get in the function with disable and when i finish i create again the window without disable
modified 14-Jan-12 18:31pm.
|
|
|
|
|
To disable a button (or any window or control) after it has been created, use the EnableWindow(hButton, FALSE); API call.
To get the handle to the button, use the GetDlgItem API.
|
|
|
|
|
I can't seem to get the function pointers working?
anybody see what's wrong? I just want to call the print()method
#include "stdio.h"
class TMyClass
{
public:
void print(){ printf("Print!\n"); };
void (TMyClass::*pt2Member)();
TMyClass(void);
};
TMyClass::TMyClass(void)
{
pt2Member = &TMyClass::print;
};
int main(int argc, char* argv[])
{
TMyClass instance1;
instance1.pt2Member;
return 0;
}
|
|
|
|
|
To call a member function using pointers you have to use the pointer to member operators (.* or ->* or ::* ).
But declaring the function pointer inside the class is not very helpful.
Usually the function pointer is declared outside the class like this -
void (TMyClass::*pt2Member)() = &TMyClass::print;
The above declaration may be done globally or inside the main function.
In this case, the function call would be as follows -
TMyClass instance1;
(instance1.*pt2Member)();
If, however, you do wish to declare the pointer inside the class like you've done here, the calling syntax would be a little weird and would look like this -
TMyClass instance1;
(instance1.*instance1.pt2Member)();
|
|
|
|
|
you earned your title 'superman'
thank you!!! works like a charm
|
|
|
|
|
Hello,
What i have is a video stream coming in, for every incoming frame i have to calculate the frame histogram and to display it graphically in the GUI.
So i have to redraw the histogram on the GUI every frame.
My problem is that i don't know how to draw the histogram,what controls to use,what functions or classes can help me?
Thanks.
|
|
|
|
|