16,003,117 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Ramiien (Top 36 by date)
Ramiien
9-Dec-15 6:44am
View
Deleted
My input is in Qstring(while reading from .Txt file)
QString str = "0x00ff2120ff040101";
for Bitwise operation i need Hexadecimal format in quint64.
quint64 num = 0x00ff2120ff040101;
int EEC = (num >> (8*6)) & 0xff;
int ER = (num >> (8*5)) & 0xff;
your suggestion please??
Ramiien
9-Dec-15 6:16am
View
Problem i am facing is I want to compare two values. Value from Network is in QString str= 20FF. and value in QHash is int value= 20FF.
Ramiien
8-Dec-15 3:45am
View
QString::arg always return me string format. what i am looking for is to get output in quint64
Ex.
(Required output) quint64 myoutput= 0xf3a.
(output with arg) QString myoutput= "0xf3a".
Ramiien
20-Nov-15 4:36am
View
i posted my code in solution 3. why its not reading the file content??
Ramiien
19-Nov-15 7:07am
View
with QFileinfo control is not coming inside the foreach loop. ?
foreach (QFileInfo fileInfo, dir.entryInfoList(filters, QDir::Files) )
Ramiien
11-Nov-15 10:28am
View
this is what i tried e.g
TStmpMilliCurrent= QString::number(timestamp.millis, 10); //getting time
int myprevTime= TStmpMilliCurrent; // trying to put it in other variable
but its not possible i am trying to put string to int. How i can do this?
Ramiien
11-Nov-15 10:18am
View
Actually i am getting time in milli seconds from CAN and trying to get the time difference between two frames
Ramiien
11-Nov-15 9:58am
View
int TStmpMilliCurrentInt = atoi(TStmpMilliCurrent);
getting msg cannot convert Qstring to const Char
Ramiien
11-Nov-15 9:15am
View
TStmpMilliCurrent= QString::number(timestamp.millis, 10);
TStmpMicroCurrent= QString::number(timestamp.micros, 10);
Now i want to add them but getting error because both are qstring type. How i can add or perform any math operation on these ??
Ramiien
10-Nov-15 5:44am
View
I posted new question with CODE
Ramiien
10-Nov-15 5:11am
View
here i am closing a file if size is >2000 than close the file1.trc and then change the file name and open the new file.
second close is for the case when size is less than 2000. if the file size would be less than 2000 it will never come inside the if condition. and I am already saving the file size into the variable "Filesize".
Ramiien
10-Nov-15 4:01am
View
this is how i am trying to do but it gives me error device not open when file size of the first file greater than 1000...
LoggerFileName = QString("C:/MyDevelopment/PcanLinker/PcanPortLinker/PcanDataLogger%1.trc").arg(j);
QFile mFile(LoggerFileName);
if(mFile.open(QIODevice::WriteOnly|QIODevice::Text));
{
for(i=0;i<2000;i++)
<!--2000--> {
if(nflag!=0)
{
nflag=0;
QFile mFile(LoggerFileName);
mFile.open(QIODevice::WriteOnly|QIODevice::Text);
}
PCANReadS = g_CAN_Read(PCAN_USBBUS1, &msg, ×tamp);
if(PCANReadS == PCAN_ERROR_OK)
{
Dataid =QString::number(msg.ID, 16);
int temp=*(int*)msg.DATA;
MsgType = msg.MSGTYPE;
Datain= QString::number(temp, 16);
TStmp= QString::number(timestamp.micros, 10);
QTextStream mylog(&mFile);
fileSize = mFile.size();
FileBasePath= mFile.fileName();
mylog <<"Msg_ " << i << ") CAN_ID(hex):" << Dataid << " DATA : " << Datain << " Time :" << TStmp << '\n';
if(fileSize > 1000) // If file size is greater than 1000 than create new file
{
j++; //incremental variable for fileName
nflag=1;
mFile.close(); //close the file1.trc
mFile.flush(); //flush the data of file1.trc
LoggerFileName = QString("C:/MyDevelopment/PcanLinker/PcanPortLinker/PcanDataLogger%1.trc").arg(j); //updatefile name file2.trc
}
}
}
}
mFile.close(); //close the file if its size is less than 1000 bytes
mFile.flush();
Ramiien
9-Nov-15 11:05am
View
What exactly i am looking for is as following
Check the size of the file if size > 50 MB
than
generate new logger_i+1.trc file
and write on the file
Else
write on logger_i.trc file
which method would be better and easy?
Ramiien
4-Nov-15 3:29am
View
M idea was that structname.element is the way to print value. e.g cout << TPCANMsg.ID to print the ID of the CAN. but it is not working. i dont know why?
Ramiien
3-Nov-15 4:48am
View
Finally i get some success to access DLL file. using Loadlibrary() and GetProcAddress()
https://www.c-plusplus.net/forum/128715-full
I have no words for Thanks.
Thanks I really appreciate your help and assistance. Danke
Ramiien
2-Nov-15 10:08am
View
Yes but in sample app it is without extention
g_i_DLL = LoadLibrary("PCANBasic");
and this also means dll file is in the same folder where this cpp file is??
Ramiien
2-Nov-15 9:36am
View
i used loadlibrary as following
HMODULE hMod = LoadLibrary(PCANBasic.dll);
it returns me error PCANBasic was undefined. it seems its defination is missing. I dont know how to define this?
Ramiien
2-Nov-15 8:29am
View
without DLL call application is running without warning. while with when call DLL functions it gives following warnings in compile output
Warning: resolving _CAN_Initialize@20 by linking to _CAN_Initialize
Use --enable-stdcall-fixup to disable these warnings
Use --disable-stdcall-fixup to disable these fixups
Warning: resolving _CAN_GetErrorText@12 by linking to _CAN_GetErrorText
Ramiien
2-Nov-15 7:19am
View
so i need to include only PCANBasic.lib file in my .pro file and place the PCANBasic.dll in the same folder.
e.g
#LIBS += "C:/MyDevelopment/PcanLinker/includes/PCANBasic.lib"
and PCANBasic.dll into the includes folder.
this what you means?
Ramiien
2-Nov-15 7:11am
View
Nothing works
Now again previous error
The program has unexpectedly finished.
C:\MyDevelopment\build-PcanPortLinker-Desktop_Qt_5_5_0_MinGW_32bit-Debug\debug\PcanPortLinker.exe crashed
I have one confussion that my MinGW debuger is 32 Bit(as you can see above..) and my system is 64 bit. does it matters? And which DLL file i need to use 32 bit or 64bit?? in my API i have 2 dll folders Win32 and x64.
Ramiien
2-Nov-15 5:04am
View
you means lib file of the API?? how lib file access DLL file?
Ramiien
2-Nov-15 5:01am
View
line 19: result = CAN_Initialize(PCAN_USBBUS1, PCAN_BAUD_250K); // to initialize pcan
line 20: breaking point
Now getting error
File not recognized:file format not recognized
C:\MyDevelopment\build-PcanPortLinker-Desktop_Qt_5_5_0_MinGW_32bit-Debug\debug\Pcanbasic.dll
it seams accessing DLL file successfully but problem is something else??
Ramiien
2-Nov-15 4:46am
View
I am getting this error screen
The program has unexpectedly finished.
C:\MyDevelopment\build-PcanPortLinker-Desktop_Qt_5_5_0_MinGW_32bit-Debug\debug\PcanPortLinker.exe crashed
I am trying in debug mood and setting breaking point at following line
result = CAN_Initialize(PCAN_USBBUS1, PCAN_BAUD_250K); // to initialize pcan
Ramiien
2-Nov-15 4:15am
View
i am using the correct file because i downloaded the windows package of API from PEAK Systems.
I am configuring the DLL file by static address like below
LIBS += "C:/myDevelopment/PcanLinker/build-PcanPortLinker-Desktop_Qt_5_5_0_MinGW_32bit-Debug/debug/PCANBasic.dll"
is it correct? maybe there could be a problem in path of DLL?
Ramiien
2-Nov-15 2:55am
View
I have only one DLL file
I am trying to call PCAN initialize function
CAN_Initialize(PCAN_USBBUS1, PCAN_BAUD_5K);
and setting breaking point at this line it returns me error
"The program has unexpectedly finished" from pcanportlinker.exe
does it means problem is in dll connection or calling function?
Ramiien
30-Oct-15 17:36pm
View
Thanks for guidance
I am facing problem in connecting DLL file in my class(myclass.cpp). it is giving me linked crash error "program has unexpectedly finished"
in .pro file i am giving the path of dll file like given below
--------------------------------------------------------------
CONFIG += "C:/mypro/debug/PCANBasic.dll"
and in myclass.cpp file
-------------------------------
#define PCANBasic.h //header file of API
CAN_Initialize(PCAN_USBBUS1, PCAN_BAUD_5K) //function of PCAN_USB API
please guide me in this problem.
Ramiien
30-Oct-15 12:02pm
View
I am using PCAN_USB so it means all parallel parameters would be 0 ??
Ramiien
30-Oct-15 9:53am
View
here is function of apifile.h file
///
/// Gets the current status of a PCAN Channel
///
/// <param name="Channel">"The handle of a PCAN Channel"</param>
/// <returns>"A TPCANStatus error code"
TPCANStatus __stdcall CAN_GetStatus(
TPCANHandle Channel)
what i am doing in mymainfile.cpp
----------------------------------
CAN_GetStatus(channel)
correct?
Ramiien
30-Oct-15 9:34am
View
i did in .h file
Ramiien
30-Oct-15 9:30am
View
If i am using one API
which contain 2 files
Apifile.h
apifile.dll
now i want to call the functions of apifile.h in my file mymainfile.cpp
what i am doing is
#include "Apifile.h" //into mymainfile.cpp
Apifile::apifilefunction()
{
return from API file will come here
}
it will work or not??
Ramiien
30-Oct-15 9:05am
View
I have one question for my clarification only
I need to list all functions of pcanlinkerclass.cpp into header file of the class??
class pCANLinkerClass
{
//...
void func1();
void func2();
void func3();
void func4();
//...
};
or is there some better way to manage these??
Ramiien
30-Oct-15 7:14am
View
Thanks bro
Ramiien
29-Oct-15 7:13am
View
if example code means code in API documentation than yes i didn't get it fully when I tried to do it in C++. would be nice if you guide me in this direction.
Ramiien
29-Oct-15 5:40am
View
Thanks for your answer. I already did this partially. right now my position is i am getting data From DLL file. e.g
qDebug() << "Hardware Name is :" << PCAN_HARDWARE_NAME;
and it returns me "14" i dont know what this means and how to get Name of the hardware and further information of the hardware from these IDs??
Ramiien
29-Oct-15 5:39am
View
Thanks for your answer. I already did this. right now my position is i am getting data From DLL file. e.g
qDebug() << "Hardware Name is :" << PCAN_HARDWARE_NAME;
and it returns me "14" i dont know what this means and how to get Name of the hardware and further information of the hardware from these IDs??
similarly
qDebug() << "Hardware channel is :" << PCAN_CHANNEL_CONDITION
I get the output "13" but as per documentation expected values would be
PCAN_CHANNEL_AVAILABLE
PCAN_CHANNEL_UNAVAILABLE
PCAN_CHANNEL_OCCUPIED
PCAN_CHANNEL_PCANVIEW
I didnot get how to get these values from documentation.
Ramiien
29-Oct-15 5:37am
View
Deleted
Thanks for your answer. I already did this. right now my position is i am getting data From DLL file. e.g
qDebug() << "Hardware Name is :" << PCAN_HARDWARE_NAME;
and it returns me "14" i dontknow what this means and how to get Name of the hardware and further information of the hardware from these IDs??
Show More