Skip to content
This repository has been archived by the owner on Oct 16, 2022. It is now read-only.

Commit

Permalink
Some Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Sharkbyteprojects committed Jan 30, 2021
1 parent fa8f8f3 commit c8974de
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 16 deletions.
28 changes: 28 additions & 0 deletions Readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
+----------------------+
|Shark String Converter|
+----------------------+

To use this, you need to include the file SharkStringConverter.h and add SharkStringConverter.dll to the files to link.

There are 2 secure functions:
#--------------------------------------#
# #
#| char * stringtochar(std::string); #
#| std::string chartostring(char*); #
# #
#--------------------------------------#

The function
| char * stringtochar(std::string);
convert the std::string to char*. the char* has the [lenght of the string +2] but only the [lenght of the string +1] will copyed to the new char.

After use the char* you should free the memory with the free function of | #include <stdlib.h>




The function
| std::string chartostring(char*);
does that what is says, it convert a char to a string

� Sharkbyteprojects
5 changes: 5 additions & 0 deletions SharkStringConverter.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SharkStringConverter", "Sha
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Test", "Test\Test.vcxproj", "{3BF93258-F47F-4D68-97CE-13233D309632}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{967BF83A-68FD-4C14-ABAB-C463C8BF2AC5}"
ProjectSection(SolutionItems) = preProject
Readme.txt = Readme.txt
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Expand Down
9 changes: 3 additions & 6 deletions SharkStringConverter/SharkStringConverter.cpp
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
// SharkStringConverter.cpp : Hiermit werden die exportierten Funktionen für die DLL definiert.
//

#include "pch.h"
#include "framework.h"
#include "SharkStringConverter.h"
using namespace std;

SHARKSTRINGCONVERTER_API char * stringtochar(string stri)
SHARKSTRINGCONVERTER_API char* stringtochar(string stri)
{
int lengthd = stri.length() + 1;
char* content{ (char*)malloc(lengthd) };
char* content{ (char*)malloc(lengthd + 1) };
if (content == nullptr || content == NULL) {
throw ("Malloc Err");
return (char*)"";
}
strcpy_s(content,(rsize_t)lengthd, stri.c_str());
strcpy_s(content, (rsize_t)lengthd, stri.c_str());
return content;
}
SHARKSTRINGCONVERTER_API string chartostring(char* stri)
Expand Down
1 change: 0 additions & 1 deletion SharkStringConverter/dllmain.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// dllmain.cpp : Definiert den Einstiegspunkt für die DLL-Anwendung.
#include "pch.h"

BOOL APIENTRY DllMain( HMODULE hModule,
Expand Down
3 changes: 1 addition & 2 deletions SharkStringConverter/framework.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#pragma once

#define WIN32_LEAN_AND_MEAN // Selten verwendete Komponenten aus Windows-Headern ausschließen
// Windows-Headerdateien
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdlib.h>
#include <sstream>
Expand Down
6 changes: 1 addition & 5 deletions SharkStringConverter/pch.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
// pch.cpp: Quelldatei, die dem vorkompilierten Header entspricht

#include "pch.h"

// Bei der Verwendung vorkompilierter Header ist diese Quelldatei für eine erfolgreiche Kompilierung erforderlich.
#include "pch.h"
3 changes: 1 addition & 2 deletions SharkStringConverter/pch.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#ifndef PCH_H
#define PCH_H

// Fügen Sie hier Header hinzu, die vorkompiliert werden sollen.
#include "framework.h"

#endif //PCH_H
#endif

0 comments on commit c8974de

Please sign in to comment.