|
Apologies for the shouting but this is important.
When answering a question please:
- Read the question carefully
- Understand that English isn't everyone's first language so be lenient of bad spelling and grammar
- If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome
- If the question is inappropriate then click the 'vote to remove message' button
Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
|
For those new to message boards please try to follow a few simple rules when posting your question.- Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
- Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
- Keep the subject line brief, but descriptive. eg "File Serialization problem"
- Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
- Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
- Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
- If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode HTML tags when pasting" checkbox before pasting anything inside the PRE block, and make sure "Ignore HTML tags in this message" check box is unchecked.
- Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
- Please do not post links to your question in one forum from another, unrelated forum (such as the lounge). It will be deleted.
- Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
- If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
- No advertising or soliciting.
- We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
|
Hi, How are you?...i hope you are doing fine... i want to ask is there any built in function to get on exact line in a file? Like:
FILE DATA:
1)Start
2)Mid
3)Username
4)END
i want to get the pointer of file handler on 3 so that i can read that specific line....
or Can we use Seekg.(); function in this case? Kindly help please
|
|
|
|
|
I don't know of such a function. If each line ends in an '\n' , you can use std::getline to read each one and count up to the line you want.
seekg moves by a specified number of characters, so it won't help unless lines are padded to a fixed length.
|
|
|
|
|
The simplest way to do this is to read the file line by line and check for the data that you are interested in. Remember a text file is just a stream of characters with no structure so you cannot easily use file positioning to get to a particular item.
|
|
|
|
|
If you have questions or comments then please use the Reply link, not the Email.
|
|
|
|
|
but i want to privately message you dont want leak my code please check the inbox kindly ... Thank you
|
|
|
|
|
Sorry, all help provided by CodeProject members is done in public through the forums on this website. If you want private help then you are in the wrong place.
|
|
|
|
|
Oh, this explains why I got an email that contained code but couldn't find the same message on this board.
Sorry, I don't do code inspections. If you don't know how to use a debugger, you need to learn now. The days when I wrote code with very few errors are gone. I wouldn't be able to do anything without a debugger now. They're so much better and easier to use than they were 40 years ago that I just focus on the design and then use the debugger to fix the details that I got wrong.
|
|
|
|
|
Okay may be i disturbed everyone here for nothing... I'm really sorry for stupid questions. I do actually know how to debug you sir when you get stuck only then you ask for help... but that debugger get the job done after 7 hours ... and Richard's steps may be helpful but it is very difficult for me to understand it you know... Anyways
Thank you for your help, i appreciate your help 
|
|
|
|
|
I am creating a program where if an action occurs then a message box through visual basic script (.vbs). I plan to do I through a fstream file.
if (statement)
{
open fstream file
}
|
|
|
|
|
And what is your question?
|
|
|
|
|
|
Probably, yes.
What program/app should execute this VB script?
|
|
|
|
|
|
VS is not to "execute", it's just to design!
Please, explain more carefully what you are going to do with your VB script. And what for?
|
|
|
|
|
|
Why on earth would you want to use a VBScript from C++ to show a messagebox?
|
|
|
|
|
Hello Folks,
Can anyone please help me to solve this runtime issue I am facing while running the application in debug mode? the error is as follows:
Debug Assertion Failed!
Program: C:\WINDOWS\SYSTEM32\mfc140ud.dll
File: f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\occcont.cpp
Line: 925
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.
The application is breaking at ASSERT(IsWindow(pTemp->m_hWnd)); line in occcont.cpp file. Thanks in advance.
|
|
|
|
|
It means that window handle (pTemp->m_hWnd) is NULL. So this window does not exist.
Look at the call stack to find which line of your code causes this assertion failure.
|
|
|
|
|
It is a reasonable guess that pTemp->m_hWnd is not a valid Window handle. How that came about is impossible to guess. You need to use your debugger to gather more diagnostic information.
Also there is some information at Debug Assertion in occcont.cpp Line: 926[^] which may help. But either way this looks to be a Microsoft problem, so you should report it (with full details) to them.
|
|
|
|
|
Good Morning everybody.
I'm developing a program in C++.
It is supposed that the program has to read from excel and write the data in a .txt file. It has to do that during 10 minutes, and after that save the .txt and start doing it again.
How can I do the timer?
May you help me please?
The program I write is this one: (Not sure if is correct)
#include
#include
#include
#include
#include
#include
using namespace std;
struct vehiculo
{
char VIN[8]
char hora[19]
};
int main()
vehiculo cocheentrante
{
File *F;
File *G;
F = fopen("C:\Users\Ford\Usuarios\Cristales\VINES.csv", "rt");
if (F == NULL)
{
cout << "No se pudo abrir el archivo de entrada. \n";
}
else
{
cout << "El archivo se abrio correctamente. \n";
}
G = fopen("dd_mm_aaaa__hh_mm_ss.txt","w");
if((G = fopen("dd_mm_aaaa__hh_mm_ss.txt","w"))!= NULL)
{
while(!feof(F))
{
fgets(VIN,8,F);
fgets(hora,19,F);
fprintf(G, "%s %s", &VIN, &hora);
}
}
fclose(G);
fclose(F);
}
modified 17-Jun-20 5:31am.
|
|
|
|
|
|
How about create your program to just do the file I/O, and then let windows handle the timer/scheduling part?
"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
|
|
|
|
|
#include<stdio.h>
void main()
{
int t,j;
scanf("%d",&t);
for(j=0;j<t;j++)
{ int num;
scanf("%d",&num);
while(num!=1)
{if(num%2==0)
num=num/2;
else
num=(3*num+1);
}
if(num==1)printf("YES\n");
else printf("NO\n");
}
}
This is my small version of given problem , the constraint is very big please give new code which satisfy the constraint mentioned in the link
<a href=""></a><code><a href=""></a><pre><pre lang="text"></pre></pre></code><a href="https://www.hackerearth.com/practice/basic-programming/input-output/basics-of-input-output/practice-problems/algorithm/conject-it/description/">Conject-It ! | Basics of Input/Output & Basic Programming Practice Problems | HackerEarth</a>[<a href="https://www.hackerearth.com/practice/basic-programming/input-output/basics-of-input-output/practice-problems/algorithm/conject-it/description/" target="_blank" title="New Window">^</a>]
|
|
|
|