|
thanks! I checked and they have the same collation seetings.
I looked into the sp_helpuser code and then realized that the one in sql server 2005 returns 7 columns but the one in sql server 2000 returns 6. My application expects 6 columns and gets the error with sql server 2005.
|
|
|
|
|
Hi,
I am sort of familiar with the functions:
GetPrivateProfileString()
WritePrivateProfileString()
used with parsing a .INI file.
What I want to do is get/set the Section names within a .INI file.
For example, if I had the .INI file
[c:\root\database\images\country.dat]
value1=1
value2=1024
value3=500
[FILENAMES]
0=c:\imagery\color\map1.jpg
1=c:\imagery\topology\elevation.dat
[c:\imagery\color\map1.jpg]
MapValue1=1
MapValue2=255:255:255
[c:\imagery\topology\elevation.dat]
TopologyData1=0
TopologyData2=1000
How can I dynamically access the Section names, within the brackets [ ], when I don't know what they could contain? AND can I change these (like re-path) and then update the .INI file?
Thank you.
|
|
|
|
|
|
That looks to be exactly what I need, half of it anyways. The other half is modifying/writing back these section names.
Thanks a million!
|
|
|
|
|
john john mackey wrote:
What I want to do is get/set the Section names within a .INI file.
Use GetPrivateProfileString(NULL, ...) .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Sorry, but this is the closest match forum I could find on CP:
I have a native C dll that exports one function besides DllEntryPoint, FuncX. I'm trying to find out how FuncX communicates with it's caller, because it has a void return type and no parameters. When I call it from a C# harness, I get an AccessViolationException - Attempted to read or write protected memory.
I have a hunch that its client application may allocate a buffer for sending or receiving values from the dll. Is this a valid hunch?
I can't debug the client application because for some reason it doesn't run, so I can't start it and attach to the process. I can, however, disassemble it in IDA Pro, but don't know how to, if I can, try and debug it in there.
|
|
|
|
|
Can you debug it from a C or C++ client, so you can step into the function in (native) disassembly mode?
Brady Kelly wrote: I'm trying to find out how FuncX communicates with it's caller, because it has a void return type and no parameters
So there's no visible interface? That says global data to me - which requires a commonly defined symbol.
Brady Kelly wrote: I have a hunch that its client application may allocate a buffer for sending or receiving values from the dll. Is this a valid hunch?
Sounds possible - but how does the buffer get into FuncX?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Stuart Dootson wrote:
Can you debug it from a C or C++ client, so you can step into the function in (native) disassembly mode?
I'd have to write that client, after a ten minute C refresher, but it's possible, and I'm not scared.Stuart Dootson wrote: Sounds possible - but how does the buffer get into FuncX?
I suspect it's at something like a constant, known offset or address in the calling code, if that's at all possible.
Right now I'm busy with an IDA Pro tutorial, to get started exploring the internals with some muscle and some baby help behind me.
|
|
|
|
|
Brady Kelly wrote: I suspect it's at something like a constant, known offset or address in the calling code, if that's at all possible
That sounds scary Especially as DLLs can be relocated...
Brady Kelly wrote: I'd have to write that client, after a ten minute C refresher, but it's possible, and I'm not scared.
extern __declspec(dllexport) void FuncX();
#pragma comment(lib, "whatever-the-DLLs-lib-file-is");
int main(int argc, char** argv)
{
FuncX();
}
or if you don't have a lib file:
#include <Windows.h>
typedef void (*FuncXType)();
int main(int argc, char** argv)
{
HMODULE myDll = ::LoadLibrary(DLL-name);
FuncXType pFuncX = (FuncXType)GetProcAddress(myDll, "FuncX");
pFuncX();
}
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks soo much! I'll try it as soon as I get home.
|
|
|
|
|
How to parse a CString: 1,1,E1,0.13060,-0.40193,-0.90631
which is a line delimited with commas of a mixture of numvers and characters.
I can read in: 1,1,E1,0.13060,-0.40193,-0.90631
using:
fscanf( f_ptr1,"%s\n",headline.GetBuffer(MAX_PATH));
headline.ReleaseBuffer();
Thanks
|
|
|
|
|
Something like:
CString headline;
...
CString Token;
int Pos = 0;
while (!(Token = headline.Tokenize(_T(","), Pos)).IsEmpty())
{
}
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
After trying yours, I got:
'Tokenize' : is not a member of 'CString'
Please check and help
|
|
|
|
|
Works for me, maybe it is some version difference or so...hmmm...that CString is the MFC CString, not some custom class, right?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Yes, CString is a MFC CString. I am using C++ 6.
|
|
|
|
|
7 here, i guess Tokenize didn't exist in version 6 yet. Well, you can either try using this[^], or hope someone who knows version 6 comes along and helps you.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Thanks. I think I need to port my program to a newer version.
Is it be much trouble to use a newer version of compiler for the present program ?
Any comments
Thanks.
|
|
|
|
|
mrby123 wrote: How to parse a CString: 1,1,E1,0.13060,-0.40193,-0.90631
which is a line delimited with commas of a mixture of numvers and characters.
By using AfxExtractSubString() .
Also, since you are using MFC, you can forgo the use of FILE and fscanf() and use CStdioFile instead. Calling GetBuffer() like you are is unnecessary and potentially dangerous.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Why not just copy it to a char * and use strtok
a programmer traped in a thugs body
|
|
|
|
|
You might want to suggest that to the original poster, rather than David.
(I suspect he knows strtok)
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
Hello guys,
i need you help with a C program that reads names from a .txt file and sort them in alphabetical order.
I have written the code for the reading part and it seems to work, but I don't know how to orgnize the bubble sort algorithm in order to compare strings and swap them.
Could you please give me some hints?
Thanks a lot,
raeiko
Here is my code:
#define SIZE 30
int main()
{
char name[ SIZE ];
FILE *fpPtr;
if ( ( fpPtr = fopen( "sorted_file.txt", "r" ) ) == NULL ) {
printf( "File could not be opened\n" );
}
else {
printf( "%s\n", "Name" );
fscanf( fpPtr, "%s", name );
while( !feof( fpPtr ) ) {
printf( "%s\n", name );
fscanf( fpPtr, "%s", name );
}
fclose( fpPtr );
}
return 0;
}
|
|
|
|
|
Why write your own bubble sort when the standard library has a quicksort built in. That way, you get a fast sort routine that you know works...
99.9999% of the time, it's better to use someone else's library code rather than write your own.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Stuart Dootson wrote: Why write your own bubble sort when the standard library has a quicksort built in.
Perhaps it's an academic exercise.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
That's what I figured - in which case, helping him isn't helping him
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
raeiko wrote: ...but I don't know how to orgnize the bubble sort algorithm in order to compare strings and swap them.
You first need to get a working bubble-sort algorithm before moving on.
int nNumbers[] = { 1, 7, 4, 10, 3, 5, 6, 9 };
int nCount = sizeof(nNumbers) / sizeof(nNumbers[0]);
...
BubbleSort(nNumbers, nCount); Work on this, and when you get stuck, we'll be glad to help.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|